Exemplo n.º 1
0
class TestSorting(unittest.TestCase):
    def setUp(self):
        self.names = ['Alice', 'Bob', 'Carl']
        self.players = [Player(x) for x in self.names]
        self.board = Board(self.players)

    def test_high_unique(self):
        self.pile = []
        self.pile.append(self.players[0].select_card(15))
        self.pile.append(self.players[1].select_card(15))
        self.pile.append(self.players[2].select_card(13))
        debug('Highest unique card: %s' % self.board.find_highest(self.pile))
        self.assertEqual(self.board.find_highest(self.pile).owner.name, 'Carl')

    def test_low_unique(self):
        self.pile = []
        self.pile.append(self.players[0].select_card(1))
        self.pile.append(self.players[1].select_card(1))
        self.pile.append(self.players[2].select_card(3))
        debug('Lowest unique card: %s' % self.board.find_lowest(self.pile))
        self.assertEqual(self.board.find_lowest(self.pile).owner.name, 'Carl')

    def test_tied(self):
        """ Test for a tie when all cards are the same """
        self.pile = []
        self.pile.append(self.players[0].select_card(15))
        self.pile.append(self.players[1].select_card(15))
        self.pile.append(self.players[2].select_card(15))
        self.assertEqual(self.board.find_highest(self.pile), None)
Exemplo n.º 2
0
class TestSorting(unittest.TestCase):
  def setUp(self):
    self.names = ['Alice', 'Bob', 'Carl']
    self.players = [Player(x) for x in self.names]
    self.board = Board(self.players)

  def test_high_unique(self):
    self.pile = []
    self.pile.append(self.players[0].select_card(15))
    self.pile.append(self.players[1].select_card(15))
    self.pile.append(self.players[2].select_card(13))
    debug('Highest unique card: %s' % self.board.find_highest(self.pile))
    self.assertEqual(self.board.find_highest(self.pile).owner.name, 'Carl')

  def test_low_unique(self):
    self.pile = []
    self.pile.append(self.players[0].select_card(1))
    self.pile.append(self.players[1].select_card(1))
    self.pile.append(self.players[2].select_card(3))
    debug('Lowest unique card: %s' % self.board.find_lowest(self.pile))
    self.assertEqual(self.board.find_lowest(self.pile).owner.name, 'Carl')

  def test_tied(self):
    """ Test for a tie when all cards are the same """
    self.pile = []
    self.pile.append(self.players[0].select_card(15))
    self.pile.append(self.players[1].select_card(15))
    self.pile.append(self.players[2].select_card(15))
    self.assertEqual(self.board.find_highest(self.pile), None)
Exemplo n.º 3
0
class TestPlay(unittest.TestCase):
    def setUp(self):
        self.names = ['Alice', 'Bob', 'Carl']
        self.players = [RandBot(x) for x in self.names]
        self.board = Board(self.players)

    def test_playthrough(self):
        self.board.run()
        print self.board.games
Exemplo n.º 4
0
class TestPlay(unittest.TestCase):
  def setUp(self):
    self.names = ['Alice', 'Bob', 'Carl']
    self.players = [RandBot(x) for x in self.names]
    self.board = Board(self.players)

  def test_playthrough(self):
    self.board.run()
    print self.board.games
Exemplo n.º 5
0
def robots():
  bots = [RandBot('Alice'), PatternBot('Bob'), RandBot('Carl'),
          KmgOneBot('Ken')]
  board = Board(bots, 30)
  board.run() 
  print board.scoreboard
Exemplo n.º 6
0
def humans():
  PLAYERNAMES = ['Kevin', 'Bob', 'Alice']
  humans = [Player(x) for x in PLAYERNAMES]
  board = Board(humans)
  board.run()
  print board.scoreboard
Exemplo n.º 7
0
def human_v_robot():
  players = [Player('Eric'), RandBot('RandBot')]
  board = Board(players)
  board.run()
  print board.scoreboard
Exemplo n.º 8
0
 def setUp(self):
     self.names = ['Alice', 'Bob', 'Carl']
     self.players = [RandBot(x) for x in self.names]
     self.board = Board(self.players)
Exemplo n.º 9
0
 def setUp(self):
   self.names = ['Alice', 'Bob', 'Carl']
   self.players = [RandBot(x) for x in self.names]
   self.board = Board(self.players)