<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Josep Valls</title>
	<atom:link href="http://josep.valls.name/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://josep.valls.name/wordpress</link>
	<description>Software and information engineering from a personal point of view</description>
	<lastBuildDate>Sun, 02 May 2010 16:37:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Terrassa Time Lapse 2,3</title>
		<link>http://josep.valls.name/wordpress/terrassa-time-lapse-23/</link>
		<comments>http://josep.valls.name/wordpress/terrassa-time-lapse-23/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 11:13:13 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=413</guid>
		<description><![CDATA[
Terrassa Time Lapse 2

Terrassa Time Lapse 3
]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/JP9Q2-q_Vjw" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/JP9Q2-q_Vjw"></embed></object></p>
<p><a href="http://www.youtube.com/watch?v=JP9Q2-q_Vjw">Terrassa Time Lapse 2</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/KSGVjYmu7cE" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/KSGVjYmu7cE"></embed></object></p>
<p><a href="http://www.youtube.com/watch?v=KSGVjYmu7cE">Terrassa Time Lapse 3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/terrassa-time-lapse-23/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Floyd–Warshall</title>
		<link>http://josep.valls.name/wordpress/floyd%e2%80%93warshall/</link>
		<comments>http://josep.valls.name/wordpress/floyd%e2%80%93warshall/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 00:48:53 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Mates]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=410</guid>
		<description><![CDATA[It was 2am and I had an exercice where I had to do a Floyd–Warshall algorithm over a graph to get the maximum cost among the minimum paths. The numbers on the paper began to blur and I found it way easier to copy the pseudocode from Wikipedia and translate into Python than to actually [...]]]></description>
			<content:encoded><![CDATA[<p>It was 2am and I had an exercice where I had to do a Floyd–Warshall algorithm over a graph to get the maximum cost among the minimum paths. The numbers on the paper began to blur and I found it way easier to copy the pseudocode from Wikipedia and translate into Python than to actually do it. Am I awesome? Is there something wrong with me?</p>
<p>Here you are.</p>
<pre>#n = num of vertices
n = 7
#this is my little aproximation to infinity... didn't want to get into the docs
m = 1e1000
#this is the matrix that describes de graph
path = [[0,4,3,m,m,m,m],[4,0,4,6,m,6,m],[3,4,0,6,m,m,m],[m,6,6,0,4,4,6],[m,m,m,4,0,6,10],[m,6,m,4,6,0,2],[m,m,m,6,10,2,0]]
for k in xrange(n):
	for i in xrange(n):
		for j in xrange(n):
			path[i][j] = min ( path[i][j], path[i][k]+path[k][j] )
			print path</pre>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/floyd%e2%80%93warshall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semana santa en Escócia</title>
		<link>http://josep.valls.name/wordpress/easter-holiday-in-scotland/</link>
		<comments>http://josep.valls.name/wordpress/easter-holiday-in-scotland/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 16:10:53 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=419</guid>
		<description><![CDATA[No hice muchas fotos, pero podéis ver más en las galerias del Dani y el Jose.
Picasa Dani: Glasgow, Edinburgh, Highlands
Flickr Dani
Flickr Jose

]]></description>
			<content:encoded><![CDATA[<p>No hice muchas fotos, pero podéis ver más en las galerias del Dani y el Jose.</p>
<p>Picasa Dani: <a href="http://picasaweb.google.es/dani.dmd86/GlasgowLochLomond">Glasgow</a>, <span><a href="http://picasaweb.google.es/dani.dmd86/EdimburgoStirling">Edinburgh</a>, <a href="http://picasaweb.google.es/dani.dmd86/IslaDeSkyeLagoNessBallachulishFallsOfDochart">Highlands</a></span></p>
<p><a href="http://www.flickr.com/photos/dare86/sets/72157623728969025/"><span>Flickr Dani</span></a></p>
<p><span><a href="http://www.flickr.com/photos/4st4roth/sets/72157623716310195/">Flickr Jose</a><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/easter-holiday-in-scotland/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DrupalCamp Spain</title>
		<link>http://josep.valls.name/wordpress/drupalcamp-spain/</link>
		<comments>http://josep.valls.name/wordpress/drupalcamp-spain/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 14:23:39 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=404</guid>
		<description><![CDATA[El fin de semana pasado asistí a la DrupalCamp Spain en el CitiLab de Cornellà (Barcelona). Fué interesante, pero la mayoría de las charlas fueron muy básicas. Aún así, estuvo bien para intercambiar experiencias. A ver si me encontráis en la foto.

]]></description>
			<content:encoded><![CDATA[<p>El fin de semana pasado asistí a la DrupalCamp Spain en el CitiLab de Cornellà (Barcelona). Fué interesante, pero la mayoría de las charlas fueron muy básicas. Aún así, estuvo bien para intercambiar experiencias. A ver si me encontráis en la foto.</p>
<p style="text-align: center;"><a href="http://josep.valls.name/wordpress/wp-content/uploads/2010/03/MG_0252.jpg"><img class="size-medium wp-image-406 aligncenter" title="_MG_0252" src="http://josep.valls.name/wordpress/wp-content/uploads/2010/03/MG_0252-300x199.jpg" alt="_MG_0252" width="300" height="199" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/drupalcamp-spain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Havel-Hakimi</title>
		<link>http://josep.valls.name/wordpress/havel-hakimi/</link>
		<comments>http://josep.valls.name/wordpress/havel-hakimi/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 16:06:54 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Codi]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=397</guid>
		<description><![CDATA[El código está en catalán pero es autoexplicativo.
def comprova(nodes):
    if sum(nodes) % 2 != 0:
      print 'la suma se graus no es parell'
      return 0
    if max(nodes) &#62; len(nodes)-1:
      print 'hi ha un node [...]]]></description>
			<content:encoded><![CDATA[<p>El código está en catalán pero es autoexplicativo.</p>
<pre>def comprova(nodes):
    if sum(nodes) % 2 != 0:
      print 'la suma se graus no es parell'
      return 0
    if max(nodes) &gt; len(nodes)-1:
      print 'hi ha un node de grau mes gran que el total de nodes'
      return 0
    if min(nodes) &lt; 0:
      print 'hi ha un node de grau negatiu'
      return 0
    if max(nodes) == 0:
      print 'es un graf correcte'
      return 0
    return 1

# mostra de Butà un hidrocarbó amb fórmula C4H10
nodes = [4,4,4,4,1,1,1,1,1,1,1,1,1,1]
# mostra d'una definició de graf incorrecte
# nodes = [6,5,5,5,5,2,1,1]

while (comprova(nodes)):
  print nodes
  nodes2 = list(nodes)
  nodes.sort()
  nodes.reverse()
  if nodes!=nodes2: print str(nodes) + " ordenat"
  node = nodes.pop(0)
  for i in range(node):
    nodes[i]=nodes[i]-1
print nodes</pre>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">def comprova(nodes):<br />
if sum(nodes) % 2 != 0:<br />
print &#8216;la suma se graus no es parell&#8217;<br />
return 0<br />
if max(nodes) &gt; len(nodes)-1:<br />
print &#8216;hi ha un node de grau mes gran que el total de nodes&#8217;<br />
return 0<br />
if min(nodes) &lt; 0:<br />
print &#8216;hi ha un node de grau negatiu&#8217;<br />
return 0<br />
if max(nodes) == 0:<br />
print &#8216;es un graf correcte&#8217;<br />
return 0<br />
return 1</p>
<p>nodes = [7,5,4,3,2,2,2]<br />
nodes = [7,6,5,4,4,3,2,1]<br />
nodes = [5,5,3,2,2,1,1]<br />
nodes = [4,3,2,2,2,2,1]<br />
nodes = [6,5,5,5,5,2,1,1]<br />
nodes = [4,4,4,4,1,1,1,1,1,1,1,1,1,1]<br />
while (comprova(nodes)):<br />
print nodes<br />
nodes2 = list(nodes)<br />
nodes.sort()<br />
nodes.reverse()<br />
if nodes!=nodes2: print str(nodes) + &#8221; ordenat&#8221;<br />
node = nodes.pop(0)<br />
for i in range(node):<br />
nodes[i]=nodes[i]-1<br />
print nodes</p></div>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/havel-hakimi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>El laberinto del Minotauro</title>
		<link>http://josep.valls.name/wordpress/el-laberinto-del-minotauro/</link>
		<comments>http://josep.valls.name/wordpress/el-laberinto-del-minotauro/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 14:02:32 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/el-laberinto-del-minotauro/</guid>
		<description><![CDATA[El laberinto del Minotauro en Python



Requieres Python 2.6 with TK.
For windows you can just grab the default python installation packages and do a full install. Then doubleclick the game py file.
To write bots to play in the game:
class AI0(AI):
	def __init__(self):
		self.name = "Bot Sample code"
		self.lastgoal = 10000
		self.option = 0
		self.options = [1,3,2,4]
		self.optionsrev = [2,4,1,3]
	def move(self,options,sensors):
		if sensors[1] &#60; [...]]]></description>
			<content:encoded><![CDATA[<p>El laberinto del Minotauro en Python<br />
<a href="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/minotaure.png"></a></p>
<p style="text-align: center;"><a href="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/minotaure.png"><img class="size-medium wp-image-388 aligncenter" title="Minotaure" src="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/minotaure-300x198.png" alt="Minotaure" width="300" height="198" /></a></p>
<p><span id="more-389"></span></p>
<p>Requieres Python 2.6 with TK.</p>
<p>For windows you can just grab the default python installation packages and do a full install. Then doubleclick the game py file.</p>
<pre>To write bots to play in the game:
class AI0(AI):
	def __init__(self):
		self.name = "Bot Sample code"
		self.lastgoal = 10000
		self.option = 0
		self.options = [1,3,2,4]
		self.optionsrev = [2,4,1,3]
	def move(self,options,sensors):
		if sensors[1] &lt; self.lastgoal:
			while 1:
				m = self.options[self.option % 4]
				if m in options: break
				self.option = self.option + 1
		else:
			m = self.optionsrev[self.option % 4]
			self.option = self.option + 1
		self.lastgoal = sensors[1]
		return m

To create a new game:
g1 = Grid(260,Point(20,20),8)
p.drawtiles(g1)
x = GameController(g1,1,0,0)
while 1:
	p.canvas.delete("player")
	p.canvas.delete("goal")
	x.update()
	p.canvas.update()
	p.canvas.after(10)</pre>
<p>I&#8217;ll be glad in you sent me your bots!</p>
<p>Download:</p>
<p><a href="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/bot_ai.py.txt">bot_ai.py</a></p>
<p><a href="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/bot_game3.py.txt">bot_game3.py</a></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">class AI8(AI):<br />
def __init__(self):<br />
self.name = &#8220;Midas2&#8243;<br />
self.lastgoal = 10000<br />
self.option = 0<br />
self.options = [1,3,2,4]<br />
self.optionsrev = [2,4,1,3]<br />
def move(self,options,sensors):<br />
if sensors[1] &lt; self.lastgoal:<br />
while 1:<br />
m = self.options[self.option % 4]<br />
if m in options: break<br />
self.option = self.option + 1<br />
else:<br />
m = self.optionsrev[self.option % 4]<br />
self.option = self.option + 1<br />
self.lastgoal = sensors[1]<br />
return m</div>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/el-laberinto-del-minotauro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Terrassa Fast motion (Time-lapse)</title>
		<link>http://josep.valls.name/wordpress/terrassa-fast-motion-time-lapse/</link>
		<comments>http://josep.valls.name/wordpress/terrassa-fast-motion-time-lapse/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 22:28:13 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=383</guid>
		<description><![CDATA[
Terrassa Time-lapse
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youtube.com/watch?v=WH2AKmQSdBI"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/WH2AKmQSdBI" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/WH2AKmQSdBI"></embed></object></a></p>
<p><a href="http://www.youtube.com/watch?v=WH2AKmQSdBI">Terrassa Time-lapse</a></p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/terrassa-fast-motion-time-lapse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arañas</title>
		<link>http://josep.valls.name/wordpress/aranas/</link>
		<comments>http://josep.valls.name/wordpress/aranas/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 19:19:28 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=379</guid>
		<description><![CDATA[El otro día ví un documental muy interesante sobre arañas y aún estando en exámenes me puse a hacer algunas pruebas.

]]></description>
			<content:encoded><![CDATA[<p>El otro día ví un documental muy interesante sobre arañas y aún estando en exámenes me puse a hacer algunas pruebas.</p>
<p style="text-align: center;"><a href="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/orbweb.png"><img class="size-medium wp-image-380 aligncenter" title="orbweb" src="http://josep.valls.name/wordpress/wp-content/uploads/2010/02/orbweb-300x200.png" alt="orbweb" width="300" height="200" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/aranas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colónia</title>
		<link>http://josep.valls.name/wordpress/colonia/</link>
		<comments>http://josep.valls.name/wordpress/colonia/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 18:05:30 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=377</guid>
		<description><![CDATA[Bendito sea Santo Ryanair. Este fin de semana fuimos con Dani a Colónia. Menos nieve de la que esperábamos.
]]></description>
			<content:encoded><![CDATA[<p>Bendito sea Santo Ryanair. Este fin de semana fuimos con Dani a Colónia. Menos nieve de la que esperábamos.</p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/colonia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atenas</title>
		<link>http://josep.valls.name/wordpress/atenas/</link>
		<comments>http://josep.valls.name/wordpress/atenas/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 17:59:23 +0000</pubDate>
		<dc:creator>Josep Valls</dc:creator>
				<category><![CDATA[Altres]]></category>

		<guid isPermaLink="false">http://josep.valls.name/wordpress/?p=373</guid>
		<description><![CDATA[He estado unos días haciendo cultura por Atenas antes de que echen grecia de la U.E.
]]></description>
			<content:encoded><![CDATA[<p>He estado unos días haciendo cultura por Atenas antes de que echen grecia de la U.E.</p>
]]></content:encoded>
			<wfw:commentRss>http://josep.valls.name/wordpress/atenas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
