Python Musings and Farkle Babies

Python is my spare time language. I wish I had opportunity to use it during my day job, but alas, JavaScript is my day job language. Not that there's anything so terrible about JavaScript, but I get wistful sometimes switching back and forth between being able to use list comprehensions and not being able to use list comprehensions.

So anyway, I wrote a breeder program in Python that breeds little Farkle-playing babies and sets them all off playing each other. The ones that win the most games survive to the next round and get to have little Farkle-playing babies, passing on their Farkle-playing genes with various mutations. The ones that don't win, sadly, become the victims of the garbage-collector. After a few hundred generations or so they got pretty good at Farkle, starting at about 20 rounds per game on average and working their way to about 16 rounds per game on average. (The idea is to get to 10000 in as few turns as possible.) Because it's ultimately based on random numbers (rolls of the dice), Farkle is one of those games where skill level (good risk-tolerance sensibilities) only gives you a marginal advantage, so in retrospect it perhaps isn't the best candidate for an EA.

One thing that struck me about Python versus JavaScript is that with Python, my tendency is to sit and think for a long time, then write a few lines of code. Whereas with JavaScript, my tendency is to spew code prolifically, thinking as I type. I don't know if this speaks more about my skill level in the respective languages, or the nature of the languages themselves. It definitely feels like I burn more keytypes in JavaScript getting ready to do, whereas in Python I burn more keytypes simply doing. Maybe we web developers should push to have Python implemented in web clients as an alternative to JavaScript, if for no other reason than to save our hands from the strain of typing all day.

Comments:

[Trackback] Bookmarked your post over at Blog Bookmarker.com!

Posted by marginal on January 22, 2008 at 09:25 AM MST #

Post a Comment:
Comments are closed for this entry.
About

My name is Greg Reimer and I'm a web technologist for the Sun.COM web design team.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today