Archive for June, 2008

import life

A console based implementation of Conway’s Game of Life in Python. As fascinating as it is useless. #!/usr/bin/python import sys import random import time import os import copy WIDTH = 32 HEIGHT = 16 class Grid:     def __init__(self, width, height):         self.width  = width         self.height = [...]

Posted by Matthew on June 20th, 2008

Filed under Uncategorized | No Comments »

Pretending PHP doesn’t suck

<?php // Perhaps the simplest practical use of a fold? // // (While this is fairly consise (even in PHP) it calculates the length of a // string 2n-2 times [which is n-2 times more than needed]) function getLongestWord($words) {   $fun = create_function(’$a,$b’, ‘return (strlen($a) > strlen($b)) ? $a : $b;’);   return array_reduce($words, [...]

Posted by Matthew on June 19th, 2008

Filed under Uncategorized | No Comments »