def StartGame(): response = input("Play a game? [Y/n] ") acceptedResponses = ['y', 'Y', 'yes', 'Yes', 'YES', ''] playGame = False gameStartCounter = 3 for item in acceptedResponses: if (response == item): playGame = True print("playing game") if (not (playGame)): print("Okay, Cya Later!") exit() response = 1 print("1: Tic Tac Toe") print("2: Four in a Row") print response = input("Select a game:") print("Game starting in...") for i in range(gameStartCounter): print("{}".format(gameStartCounter - i)) sleep(.5) if (response == '1'): tictactoe.main() input("\n\nPress the enter key to quit.") elif (response == '2'): fourinarow2.main() else: exit()
def main(): """ Futher than Tictactoe applications are considered, including random walk, maze, etc. """ Done = False while not Done: print() print('==RL Aget Testing Framework ==') print('- Developed by Sungjin Kim, 2020') print() print('0) Tictactoe') print('1) Random walk') print('2) MAB') print('999) Quit') Q1 = input_default_with('Which application do you want to perform?', 999, int) if Q1 == 0: tictactoe.main() elif Q1 == 1: randomwalk.main() elif Q1 == 2: mab.main() elif Q1 == 999: Done = True else: print('Type a different option listed in the above table.')
def ventanaEleccionJuego(jugador): layout = [[ sg.Button("Ahorcado"), sg.Button("TaTeTi"), sg.Button("Reverse") ], [sg.Exit()]] window = sg.Window('JUEGOS').Layout(layout).Finalize() while True: event, values = window.Read( ) #QUISE USAR KEYS PARA NO TENER QUE PASAR "event" A "MODIFICAR()", PERO EL PROGRAMA SE TRABA if event is None or event == 'Exit': break elif event == "Ahorcado": modificar(jugador, event) window.Close() hangman.main() break elif event == "TaTeTi": modificar(jugador, event) window.Close() tictactoe.main() break elif event == "Reverse": modificar(jugador, event) window.Close() reversegam.main() break
def select(selection): #route to calculator if selection == '1': calculator.main() print() main() #route to compound interest calculator elif selection == '2': compoundInterestCalculator.main() print() main() #route to rock paper scissors game elif selection == '3': rockpaperscissors.main() print() main() #route to countoff game elif selection == '4': countoff.main() print() main() #route to tictactoe game elif selection == '5': tictactoe.main() print() main() #exit program elif selection == '6': print("Goodbye!") return #catch all invalid entries and restart main else: print("Invalid Entry!") print() main()
if event in (None, 'Salir'): break if (values[0] == ''): sg.popup('Ingrese nombre') else: archivo = open("Informacion.txt", "a") if event in ('Hangman'): infoJugador['Nombre'] = values[0] infoJugador['Juego'] = 'Hangman' infoJugador['Fecha'] = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) window.close() hangman.main() if event in ('Reverse'): infoJugador['Nombre'] = values[0] infoJugador['Juego'] = 'Reverse' infoJugador['Fecha'] = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) window.close() reversegam.main() if event in ('TicTacToe'): infoJugador['Nombre'] = values[0] infoJugador['Juego'] = 'TicTacToe' infoJugador['Fecha'] = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) window.close() tictactoe.main() json.dump(infoJugador, archivo) archivo.close() window.close()
def hello_world(): return main()