コード例 #1
0
    def test_king_moves(self):
        """Test of king_moves() method."""

        assert sorted(PieceMoves.king_moves(Position(4, 0), self.game)) == [
            Move(Position(4, 0), Position(3, 0)),
            Move(Position(4, 0), Position(3, 1)),
            Move(Position(4, 0), Position(4, 1)),
            Move(Position(4, 0), Position(5, 0)),
            Move(Position(4, 0), Position(5, 1)),
            Move(Position(4, 0), Position(6, 0)),
        ]
コード例 #2
0
 def test_all_moves(self):
     """Test of all_moves() method."""
     assert sorted(PieceMoves.all_moves(self.game)) == [
         Move(Position(0, 0), Position(1, 0)),
         Move(Position(0, 0), Position(2, 0)),
         Move(Position(0, 0), Position(3, 0)),
         Move(Position(0, 1), Position(0, 2)),
         Move(Position(0, 1), Position(0, 3)),
         *sorted(PieceMoves.king_moves(Position(4, 0), self.game)),
         Move(Position(4, 4), Position(3, 5)),
         Move(Position(4, 4), Position(4, 5)),
         Move(Position(7, 0), Position(5, 0)),
         Move(Position(7, 0), Position(6, 0)),
         Move(Position(7, 1), Position(7, 2)),
         Move(Position(7, 1), Position(7, 3)),
     ]