Esempio n. 1
0
 def setUp(self):
     p = Position()
     self.moves = p.get_legal_moves()
     m1 = Move.from_uci('e2e4')
     m2 = Move.from_uci('b1c3')
     self.san = SanNotation(p, m1)
     self.san_dup = SanNotation(p, m1)
     self.san_other = SanNotation(p, m2)
     self.position = p
     self.m1 = m1
     self.m2 = m2
Esempio n. 2
0
 def get_prev_moves(self, format="raw"):
     if self.previous_node:
         if format=="raw":
             return self.previous_node.get_prev_moves() + " " + str(self.move)
         else:
             return self.previous_node.get_prev_moves() + " " + str(SanNotation(self.previous_node.position, self.move))
     return " "
Esempio n. 3
0
    def reset(self):
        pass

    # do we want this public?
    def toggle_turn(self):
        """Toggles whos turn it is."""


if __name__ == '__main__':
    from notation import SanNotation

    f = Position()
    #    print 11, f['a1']
    #    print 11, f[Square('a1')]
    m = Move.from_uci('b1c3')
    print SanNotation(f, m)
    f.make_move(m)
    print f

    f.make_move(Move.from_uci('c7c5'))
    print f

    print f["a7"]
#
#    for move in f.get_legal_moves():
#        move
#    print f.is_check()
#    print f.is_checkmate()
#    print f.is_stalemate()
#    print f.is_game_over()
#
Esempio n. 4
0
 def test___init__(self):
     for move in self.moves:
         san = SanNotation(self.position, move)