-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ce8723
commit 166a5c1
Showing
4 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from tictactoe.game import play | ||
|
||
fn main(): | ||
play[4](0, 0) | ||
play[4](1, 1) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
from testing import assert_equal | ||
from tictactoe.game import play | ||
from tictactoe.game import Move, BOARD, X, O, OPEN, _swap_player, _minmax | ||
|
||
def test_play(): | ||
assert_equal(play(), 1) | ||
def test_minmax(): | ||
var board = BOARD[16](X, O, OPEN, OPEN, X, O, OPEN, OPEN, X, O, OPEN, OPEN, OPEN, OPEN, OPEN, OPEN) | ||
var result = _minmax[X, 4](board) | ||
assert_equal(result.score, 1) | ||
assert_equal(result.spot, 12) | ||
|
||
def test_swap_player(): | ||
assert_equal(_swap_player(X), O) | ||
assert_equal(_swap_player(O), X) |
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