def create_game_object(message): global sessions if sessions.get(message.chat.id) != 's': bot.send_message(message.chat.id, locale.wrong_command) return if message.text == locale.white: sessions[message.chat.id] = Game(enemy_white=True) reply = '' else: sessions[message.chat.id] = Game(enemy_white=False) moves_done = sessions[message.chat.id].black_first_move() reply = bot_reply(moves_done) picture = open('tmp.png', 'rb') bot.send_photo(message.chat.id, picture, '{}{}'.format(reply, locale.hi), reply_markup=make_markup(sessions[message.chat.id], False))
arm.move_j([move2, 1, 1]) #logic for determining if move jumped a piece if (abs(move1 - move2) >= 14): val = (move2 - move1) / 2 pickup = move1 + val #waits til human says to continue gameplay stop = input("tell when to go") #pickup and trash jumped piece arm.move_j([pickup, 0, 1]) arm.move_j([pickup, 1, 0]) # initialize game object game = Game.Game() # set ip and port arm = ArmController('192.168.125.1', 3000) #'130.215.217.14',3000) #192.168.100.100 #attempt to connect arm.connect() game.consecutive_noncapture_move_limit = 50 while True: #human player turn if game.whose_turn() == 1: #breaks loop if game is over if game.is_over(): break print("\nYour possible moves: ")
def main(): Game()