Exemplo n.º 1
0
 def test_choose_with_pre_choice(self):
     test_player = Player()
     test_plate = [['A', 'B', 'A'], ['C', 'D', 'A'], ['A', 'X', 'X']]
     test_player.set_cur_choice(test_plate[0][0])
     self.assertEqual('B', test_player.choose(plate=test_plate))
Exemplo n.º 2
0
from __future__ import unicode_literals
import sys
from src.Board import Board
from src.Player import Player


__author__ = "Zeinab Abbasimazar -> https://github.com/zeinababbasi"


n, m = 3, 3


if __name__ == "__main__":
    board = Board(dimension=n, color_count=m)
    player = Player()
    player.set_cur_choice(choice=board.get_origin())
    sys.stdout.write("You've started it; board dimension is %d and color count is %d\n" % (n, m))
    round_count = 1

    while board.has_differences():
        sys.stdout.write("This is the board for round #%d..." % round_count)
        board.draw_board()
        plate = board.get_plate()
        choice = player.choose(plate=plate)
        board.update_plate(cur_color=choice)
        round_count += 1

    sys.stdout.write("It's finished!")
    board.draw_board()
Exemplo n.º 3
0
 def test_choose_with_no_pre_choice(self):
     test_player = Player()
     test_plate = [['A', 'B', 'A'], ['C', 'D', 'A'], ['A', 'X', 'X']]
     self.assertEqual('A', test_player.choose(plate=test_plate))