Exemple #1
0
 def test_getCoordinatesFromUserInput_long_simple(self):
     """ Get coordinates from a long input without extra notation """
     actualValue = interface.getCoordinatesFromUserInput('4637')
     expectedValue0 = coordinate.Coordinate(4, 6)
     expectedValue1 = coordinate.Coordinate(3, 7)
     self.assertCoordinatesMatch(actualValue[0], expectedValue0)
     self.assertCoordinatesMatch(actualValue[1], expectedValue1)
Exemple #2
0
 def test_getCoordinatesFromUserInput_long(self):
     """ Get coordinates from a long input """
     actualValue = interface.getCoordinatesFromUserInput('9,7-0,8')
     expectedValue0 = coordinate.Coordinate(9, 7)
     expectedValue1 = coordinate.Coordinate(10, 8)
     self.assertCoordinatesMatch(actualValue[0], expectedValue0)
     self.assertCoordinatesMatch(actualValue[1], expectedValue1)
Exemple #3
0
 def test_getCoordinatesFromUserInput_good_with_comma(self):
     """ Get coordinates from good input with comma """
     actualValue = interface.getCoordinatesFromUserInput('3,4')[0]
     expectedValue = coordinate.Coordinate(3, 4)
     self.assertEqual(actualValue.get_x_board(),
                      expectedValue.get_x_board())
     self.assertEqual(actualValue.get_y_board(),
                      expectedValue.get_y_board())
Exemple #4
0
 def test_getCoordinatesFromUserInput_long(self):
     """ Get coordinates from a long input """
     actualValue = interface.getCoordinatesFromUserInput('3,4-5,6')
     expectedValue0 = coordinate.Coordinate(3, 4)
     expectedValue1 = coordinate.Coordinate(5, 6)
     self.assertEqual(actualValue[0].get_x_board(),
                      expectedValue0.get_x_board())
     self.assertEqual(actualValue[1].get_y_board(),
                      expectedValue1.get_y_board())
Exemple #5
0
 def test_getCoordinatesFromUserInput_long_simple(self):
     """ Get coordinates from a long input without extra notation """
     actualValue = interface.getCoordinatesFromUserInput('3456')
     expectedValue0 = coordinate.Coordinate(3, 4)
     expectedValue1 = coordinate.Coordinate(5, 6)
     self.assertEqual(actualValue[0].get_x_board(),
                      expectedValue0.get_x_board())
     self.assertEqual(actualValue[1].get_y_board(),
                      expectedValue1.get_y_board())
Exemple #6
0
 def test_matchMultipleCoordinatesToMoves_goose_unambiguous(self):
     """ Match multi-coordinate goose input to move """
     aiObject = ai.AI()
     gooseP = True
     listOfMoves = aiObject.getAllMovesForPlayer(self.shared_game, gooseP)
     coordinates = interface.getCoordinatesFromUserInput("25-35")
     actualValue = interface.matchMultipleCoordinatesToMoves(listOfMoves,
                                                             coordinates,
                                                             gooseP)
     self.assertEqual(len(actualValue), 1)
Exemple #7
0
 def test_matchMultipleCoordinatesToMoves_goose_nonexistant(self):
     """ Get coordinates from moves where there are none """
     aiObject = ai.AI()
     gooseP = True
     listOfMoves = aiObject.getAllMovesForPlayer(self.shared_game, gooseP)
     coordinates = interface.getCoordinatesFromUserInput("54-55")
     actualValue = interface.matchMultipleCoordinatesToMoves(listOfMoves,
                                                             coordinates,
                                                             gooseP)
     self.assertEqual(len(actualValue), 0)
Exemple #8
0
 def test_matchMultipleCoordinatesToMoves_playerB_unambiguous(self):
     """ Match multi-coordinate playerB input to move """
     userIsPlayerB = True
     gnObject = gamenode.GameNode()
     gnObject.createStartingPosition()
     listOfMoves = ai.getAllMovesForPlayer(gnObject, not userIsPlayerB)
     coordinates = interface.getCoordinatesFromUserInput("3746")
     actualValue = interface.matchMultipleCoordinatesToMoves(
         listOfMoves, coordinates, userIsPlayerB)
     self.assertEqual(len(actualValue), 1)
Exemple #9
0
 def test_matchMultipleCoordinatesToMoves_fox_ambiguous_long(self):
     """ Test for single result from a long series of coordinates """
     aiObject = ai.AI()
     gooseP = False
     listOfMoves = aiObject.getAllMovesForPlayer(self.looped_capture,
                                                 gooseP)
     coordinates = interface.getCoordinatesFromUserInput("42-24-46-64")
     actualValue = interface.matchMultipleCoordinatesToMoves(listOfMoves,
                                                             coordinates,
                                                             gooseP)
     self.assertEqual(len(actualValue), 1)
Exemple #10
0
 def test_matchMultipleCoordinatesToMoves_fox_ambiguous_short(self):
     """ Test for single result from multiple coordinates """
     aiObject = ai.AI()
     gooseP = False
     listOfMoves = aiObject.getAllMovesForPlayer(self.looped_capture,
                                                 gooseP)
     coordinates = interface.getCoordinatesFromUserInput("42-64")
     actualValue = interface.matchMultipleCoordinatesToMoves(listOfMoves,
                                                             coordinates,
                                                             gooseP)
     for item in actualValue:
         item.pretty_print_board()
     self.assertEqual(len(actualValue), 1)
Exemple #11
0
 def test_getCoordinatesFromUserInput_bad_short(self):
     """ Parse a short bad input string """
     actualValue = interface.getCoordinatesFromUserInput('3')
     self.assertEqual(len(actualValue), 0)
Exemple #12
0
 def test_getCoordinatesFromUserInput_very_long(self):
     """ Get coordinates from a long input without extra notation """
     actualValue = interface.getCoordinatesFromUserInput("42-24-46-64")
     self.assertEqual(len(actualValue), 4)
Exemple #13
0
 def test_getCoordinatesFromUserInput_very_long(self):
     """ Get coordinates from a long input without extra notation """
     actualValue = interface.getCoordinatesFromUserInput("42-24-46-64")
     self.assertEqual(len(actualValue), 4)
Exemple #14
0
 def test_getCoordinatesFromUserInput_bad_short(self):
     """ Parse a short bad input string """
     actualValue = interface.getCoordinatesFromUserInput('3')
     self.assertEqual(len(actualValue), 0)
Exemple #15
0
 def test_getCoordinatesFromUserInput_bad_long(self):
     """ Parse a long bad input string """
     actualValue = interface.getCoordinatesFromUserInput('345t')
     self.assertEqual(len(actualValue), 0)
Exemple #16
0
 def test_getCoordinatesFromUserInput_good_with_comma(self):
     """ Get coordinates from good input with comma """
     actualValue = interface.getCoordinatesFromUserInput('8,6')[0]
     expectedValue = coordinate.Coordinate(8, 6)
     self.assertCoordinatesMatch(actualValue, expectedValue)
Exemple #17
0
 def test_getCoordinatesFromUserInput_bad_long(self):
     """ Parse a long bad input string """
     actualValue = interface.getCoordinatesFromUserInput('345t')
     self.assertEqual(len(actualValue), 0)
Exemple #18
0
 def test_getCoordinatesFromUserInput_outside_long(self):
     """ Parse an input string outside the board """
     actualValue = interface.getCoordinatesFromUserInput('3459')
     self.assertEqual(len(actualValue), 0)
Exemple #19
0
 def test_getCoordinatesFromUserInput_outside_long(self):
     """ Parse an input string outside the board """
     actualValue = interface.getCoordinatesFromUserInput('3459')
     self.assertEqual(len(actualValue), 0)
Exemple #20
0
 def test_getCoordinatesFromUserInput_good(self):
     """ Get coordinates from good input """
     actualValue = interface.getCoordinatesFromUserInput('33')[0]
     expectedValue = coordinate.Coordinate(3, 3)
     self.assertCoordinatesMatch(actualValue, expectedValue)