This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| int[][] data = new int[3][3]; | |
| private void aiMove() { | |
| Score s = minimax(null, true); | |
| data[s.move.x][s.move.y] = COMPUTER; | |
| } | |
| static class Score { | |
| Point move; | |
| int score; |
| package main | |
| import "fmt" | |
| type genf func(chan<- uint8) | |
| func gen(f genf) <-chan uint8 { | |
| c := make(chan uint8) | |
| go f(c) | |
| return c |
| var noop = []; | |
| function stream(arr){ | |
| if(arr.length === 0) return noop; | |
| return cons(function (){return arr[0]}, function (){ return stream(arr.slice(1))}) | |
| } | |
| function cons(head, tail){ | |
| return [head, tail]; | |
| } |