def will_play(name1, name2): c = chess.chess(name1, name2, False) print(c) c.move('e7 e5') # Will print(c) c.move('e2 e4') # Jan print(c) c.move('g8 f6') print(c) """ c.move('d2 d3') print(c) c.move('a7 a5') print(c) c.move('f2 f4') print(c) c.move('f6 g4') print(c) c.move('f4 f5') print(c) c.move('f8 b4') print(c) c.move('e1 h4') print(c)""" return c
def jan_fool_checkmate(name1, name2): c = chess.chess(name1, name2, False) print(c) c.move('f2 f3') print(c) c.move('e7 e5') print(c) c.move('g2 g4') print(c) c.move('d8 h4') print(c) print('Fool: ',c.turn_all(True)) print('a1: ',c.look('a1')) print('a2: ',c.look('a2')) print('a6: ',c.look('a6')) print('a7: ',c.look('a7'))
def tall_play_1(): name1 = '*****@*****.**' name2 = '*****@*****.**' c = chess.chess(name1,name2) print('>>>: ',c.turn_all(True)) c.move('d2 d4') # Jan print(c) return c
def chess_tut(): name1 = '*****@*****.**' name2 = '*****@*****.**' c = chess.chess(name1,name2) print(c) c.move('f2 f3') print(c) c.move('e7 e5') print(c) c.move('g2 g4') print(c) c.move('d8 h4') print(c) #c.blackIsLegal() #print(c) #c.whiteIsLegal() #print(c) print(c.move_begin()) print(c.move_next()) print(c.move_next()) print(c.move_next()) print(c.move_next()) print(c.move_next()) print(c.move_prev()) print(c.move_prev()) print(c.move_prev()) print(c.move_prev()) print(c.move_prev()) print(c.move_prev()) print(c.move_end()) #print(c) return c
def chess_white( email = -1 ): u = request.get_cookie('username','', secret='the sercet') c1 = chess(email, u) d.add(c1) redirect("/dashboard/" + str(c1.random_chess))
import socket from chess import chess chess = chess.chess() #host = 'janbannister.com' # Symbolic name meaning the local host host = 'localhost' # Symbolic name meaning the local host port = 51234 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(1) conn, addr = s.accept() print('Connected by', addr) while 1: data = conn.recv(1024) if not data: break c = bytes(str(chess)) conn.send('Chess> ') a = None while a != 'q': a = input('Chess> ') if(a == 'q'): pass else: try: #chess.move('a2 a3') chess.move(a) except AssertionError as e: print(e) #c = bytes(chess)
# | # | # ranks - 1 <== ==> ranks + 1 # | # | # V # files + 1 if __name__ == "__main__": from chess import chess, play name1 = '*****@*****.**' name2 = '*****@*****.**' c = chess.chess(name1, name2) #c = play.jan_fool_checkmate(name1, name2) r,f = c.notationToArray('a1') print('ranks:', r) print('files:', f) move = c.arrayToNotation(0, 7) print('move:', move) r,f = c.notationToArray('c6') print('ranks:', r) print('files:', f) move = c.arrayToNotation(2, 2)
def shane_play(): name1 = '*****@*****.**' name2 = '*****@*****.**' c = chess.chess(name1,name2) print('xxx: ',c.turn_all(True)) print(c) c.move('d2 d4') print(c) c.move('d7 d5') print(c) c.move('b1 c3') print(c) c.move('e7 e6') print(c) c.move('e2 e3') print(c) c.move('c7 c6') print(c) c.move('d1 d3') print(c) c.move('g7 g6') print(c) c.move('e3 e4') print(c) c.move('d5 e4') #pawn white print(c) c.move('c3 e4') #pawn black print(c) c.move('f7 f5') print(c) c.move('e4 g3') print(c) c.move('b8 a6') print(c) c.move('c1 f4') print(c) c.move('f8 d6') print(c) c.move('g1 h3') print(c) c.move('h7 h5') print(c) # Castling c.move('castling left') print(c) c.move('d8 c7') print(c) c.move('f4 g5') print(c) c.move('a6 b4') print(c) c.move('d3 c4') print(c) c.move('h5 h4') print(c) c.move('g3 f5') print(c) c.move('e6 f5') print(c) c.move('d1 e1') # Check print(c) c.move('g8 e7') print(c) c.move('g5 f6') print(c) c.move('h8 f8') print(c) c.move('f6 g7') print(c) c.move('f8 g8') print(c) c.move('e1 e7') # check print(c) c.move('e8 e7') print(c) c.move('c4 g8') print(c) c.move('b4 a2') # check print(c) c.move('c1 b1') # error print(c) c.move('a2 b4') # error print(c) c.move('f1 c4') # error print(c) c.move('b4 d5') # error print(c) c.move('h1 e1') # error print(c) c.move('d6 e5') # error print(c) c.move('g7 e5') # error print(c) c.move('c7 d8') # error print(c) c.move('e5 c7') # error Check print(c) c.move('c8 e6') # error print(c) c.move('g8 e6') # error Check print(c) c.move('e7 f8') # error print(c) c.move('c7 d8') # error print(c) c.move('a8 d8') # error print(c) c.move('c4 d5') # error print(c) c.move('c6 d5') # error print(c) c.move('e6 f6') # error Checks print(c) c.move('f8 g8') # error print(c) c.move('f6 d8') # error Checks print(c) print('xxx: ',c.turn_all(True)) return c