spotOn

Saturday June 12, 2010

Apparently, I had a corrupted version of spotOn uploaded on the site. It has been fixed now, but you'll still need some sort of emulator to run it.


Train

Tuesday April 20, 2010

I recently watched Brenda Brathwaite's Train talk after it was put up for free on the GDC Vault, and I must say it is astounding. I'm really not sure how to describe it, but do yourself a favour; take an hour and watch the whole thing. It is eye opening and worth the hour.


Heavy Rain

Sunday February 28, 2010

How far are you prepared to go to save someone you love?

This is the question that Heavy Rain poses. Despite making you want a Klondike bar, it grips you by the throat and refuses to let go until it has wrung every last emotion out of of your waking soul!

OK. Maybe thats a bit much, but this game is one where I actually found myself scared. Not bad horror movie scared where the cat jumps out from behind the door, but bona-fide scared for my life, or rather, the life of one of my characters. Its hard to tell the difference sometimes. I actually had to take a minute during the second trial to regain my bearings and calm down. Heavy Rain's deliberate pacing and twisted story allows it to build tension throughout better than any other game I've played.

There were disconnects during the experience, which I'm very sad about, some lines were missed while character's mouths moved. I also experienced one or two small freezes, lasting a few seconds each, but those were all in the first chapter, so I quickly forgot about them. Regardless, Heavy Rain is incredibly compelling to play and has a phenomenal story which changes to some degree based on the actions (or inactions) of your characters.


PHP Golf: Hole 3

Thursday February 11, 2010


/**
* int2word
* BlueSfear PHP Golf, Hole 3 winner.
* Convert any positive value of a 32-bit signed integer to an English
* textual representation of that integer.
*
* @author 666
* @param number
* @return textual representation of number
*/
function int2word($number)
{
$length = strlen($number);
$ones = array('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
$teens = array('ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen');
$tens = array('twenty', 'thirty', 'fourty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety');
$millions = array('Thousand', 'Million', 'Billion');

for ($i = 0; $i < $length / 3; $i++) {
$w = $length -1 -($i*3);
$a = $number[$w];
$b = $number[$w-1];
$c = $number[$w-2];

if ($a != 0 && $b != 0 && $c != 0 && $i != 0) $x[] = $millions[$i-1];

if ($b == 1) {
$x[] = $teens[$a];
} else {
$x[] = $ones[$a];
$x[] = $tens[$b-2];
}
if ($c != 0) $x[] = 'Hundred';
$x[] = $ones[$c];
}
return join(' ', array_reverse($x));
}

// Original (526 chars):
function g($t){$l=strlen($t);$m=array(THOUSAND,MILLION,BILLION);
$n=array("",one,two,three,four,five,six,seven,eight,nine);
$o=array(twenty,thirty,fourty,fifty,sixty,seventy,eighty,ninety);
$p=array(ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,
eighteen,nineten);for($i=0;$i<$l/3;$i++){$w=$l-1-($i*3);$a=$t{$w};$b=$t{$w-1};$c=$t{$w-2};$c==0&$a==0&$b==0&$i==1?"":$x[]=$m[$i-1];if($b==1){$x[]=$p[$a];}else{$x[]=$n[$a];$x[]=$o[$b-2];}$c!=0?$x[]="HUNDRED":0;$x[]=$n[$c];}return join(" ",array_reverse($x));}


PHP Golf: Hole 2

Friday January 22, 2010

/**
* int2roman
* BlueSfear PHP Golf, Hole 2 winner.
* Covert a whole number (ie. a positive integer) to a roman numeral
* representation.
*
* @author 666
* @param number - integer between 0 and 5000
* @return roman numeral representation of number
*/
function int2roman($number)
{
if (!is_int($number) || $number > 5000 || $number < 1) return false;

$integers = array(1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1);
$numerals = array('M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I');
for ($i = 0; $i < 13; $i++) {
while ($number >= $integers[$i]) {
$numeral .= $numerals[$i];
$number -= $integers[$i];
}
}

return $numeral;
}
// Original (239 chars): function
r($a){$b=$a;$c=array(1000,900,500,400,100,90,50,40,10,9,5,4,1); $d=array("M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I");for($i=0;$i<13;$i++)while($a>=$c[$i]){$s.=$d[$i];$a-=$c[$i];}return(is_int($b)&$b<5001&$b>0)?$s:0;}


As an added bonus, I recreated this function to work with numbers larger than 5000, but not exactly keeping it short.
/**
* int2roman2
* Convert any positive value of a 32-bit signed integer to its modern roman
* numeral representation. Numerals within parentheses are multiplied by
* 1000. ie. M == 1 000, (M) == 1 000 000, ((M)) == 1 000 000 000
*
* @author Black Majic
* @param number - an integer between 1 and 2147483647
* @return roman numeral representation of number
*/
function int2roman2($number)
{
if (!is_int($number) || $number < 1) return false; // ignore negative numbers and zero

$integers = array(900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1);
$numerals = array('CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I');
$major = intval($number / 1000) * 1000;
$minor = $number - $major;
$numeral = $leastSig = '';

for ($i = 0; $i < sizeof($integers); $i++) {
while ($minor >= $integers[$i]) {
$leastSig .= $numerals[$i];
$minor -= $integers[$i];
}
}

if ($number >= 1000 && $number < 40000) {
if ($major >= 10000) {
$numeral .= '(';
while ($major >= 10000) {
$numeral .= 'X';
$major -= 10000;
}
$numeral .= ')';
}
if ($major == 9000) {
$numeral .= 'M(X)';
return $numeral . $leastSig;
}
if ($major == 4000) {
$numeral .= 'M(V)';
return $numeral . $leastSig;
}
if ($major >= 5000) {
$numeral .= '(V)';
$major -= 5000;
}
while ($major >= 1000) {
$numeral .= 'M';
$major -= 1000;
}
}

if ($number >= 40000) {
$major = $major/1000;
$numeral .= '(' . int2roman2($major) . ')';
}

return $numeral . $leastSig;
}