Last active
December 11, 2015 07:29
-
-
Save kulte/4566961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('minimax', function () { | |
var INFINITY = 1.7976931348623157E+10308; | |
var N_INFINITY = -1.7976931348623157E+10308; | |
var COMPUTER = 1; | |
var HUMAN = 2; | |
it('should return INFINITY when computer has won', function () { | |
var state = [1, 1, 1, -1, -1, -1, -1, 2, 2]; | |
var board = new Board(state); | |
assert.equal(board.minimax(COMPUTER), INFINITY); /* assertion passes */ | |
}) | |
it('should return N_INFINITY when human has won', function () { | |
var state = [-1, 1, 1, -1, -1, -1, 2, 2, 2]; | |
var board = new Board(state); | |
assert.equal(board.minimax(COMPUTER), N_INFINITY); /* assertion fails */ | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment