示例#1
0
    def test_zobrist_hashing(self):

        myBoard = GoBoard(9, 9)

        original_hash = myBoard.zobrist_hashes.current_hash
        myBoard.place_stone(BoardLocation(5, 5), True)
        self.assertNotEqual(myBoard.zobrist_hashes.current_hash, original_hash)
        myBoard.remove_group(myBoard.groups[0])
        self.assertEqual(myBoard.zobrist_hashes.current_hash, original_hash)
示例#2
0
    def test_remove_groups(self):

        myBoard = GoBoard(9, 9)

        g1_stones = [BoardLocation(1, 1), BoardLocation(1, 2)]
        g1_liberties = [BoardLocation(0, 0)]

        g1 = GoString(True, g1_stones, g1_liberties)
        myBoard.groups = [g1]
        self.assertEqual(len(myBoard.groups), 1)
        myBoard.remove_group(g1)
        self.assertEqual(len(myBoard.groups), 0)