-
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
Andrius Chamentauskas
committed
May 26, 2010
1 parent
195a3b0
commit 0744403
Showing
7 changed files
with
218 additions
and
28 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
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
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,8 +1,34 @@ | ||
from puyo.player import * | ||
from puyo.board import * | ||
from nose.tools import * | ||
import pygame | ||
pygame.init() | ||
|
||
class TestPlayer(): | ||
pass | ||
class TestAI(): | ||
def add_puyo(self, color, row, col): | ||
self.board.add(Puyo(self.board, color, row, col)) | ||
|
||
def set_next_pair(self, color1, color2): | ||
self.board.score.next_pair[0].color = color1 | ||
self.board.score.next_pair[1].color = color2 | ||
|
||
def setup(self): | ||
self.board = Board(10, (10, 5), (32, 32)) | ||
self.add_puyo('yellow', 7, 0) | ||
self.add_puyo('yellow', 8, 0) | ||
self.add_puyo('yellow', 9, 0) | ||
|
||
def test_ai_move(self): | ||
self.set_next_pair('yellow', 'green') | ||
player = ComputerPlayer(self.board) | ||
self.set_next_pair('yellow', 'yellow') | ||
player.next_move() | ||
assert_equal(player.move, [2, 0, 19]) | ||
|
||
def test_ai_tries_to_minimize_height(self): | ||
self.set_next_pair('green', 'red') | ||
player = ComputerPlayer(self.board) | ||
self.set_next_pair('green', 'red') | ||
player.next_move() | ||
assert_equal(player.move, [1, 0, -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