def sendmenu(): while True: print '\nChoose an option to send Pokemon:' print 'o - send one Pokemon to game' print 'm - choose & send multiple Pokemon to game' print 'f - send all Pokemon in queue folder' print 'c - choose folder full of Pokemon to send' print 'r - return to main menu' print 'q - quit\n' print '\nPlease type your option, and press Enter\n' soption = raw_input().strip().lower() if soption.startswith('o'): clear() sendpkm() elif soption.startswith('m'): clear() multisend() elif soption.startswith('f'): clear() queuesend() elif soption.startswith('c'): clear() customqueuesend() elif soption.startswith('r'): clear() break elif soption.startswith('q'): print 'Quitting program' cleanexit() else: print 'Invalid option, try again' continue print 'Returning to send menu...'
def convertmenu(): while True: print '\nChoose a conversion option:' print '1 - convert 3rd gen Pokemon file to 4th gen .pkm' print '2 - convert 3rd gen Pokemon file to 5th gen .pkm' print '3 - convert 4th gen .pkm to 5th gen .pkm' print 'r - return to main menu' print 'q - quit' number = raw_input().strip().lower() if number.startswith('1'): clear() threetofour() elif number.startswith('2'): clear() threetofive() elif number.startswith('3'): clear() fourtofive() elif number.startswith('r'): clear() break elif number.startswith('q'): clear() print 'Quitting program' cleanexit() else: print 'Invalid option, try again' continue print 'Returning to conversion menu...'
def offlinemenu(): while True: print '\nChoose:' print 'a - analyze pkm file' print 'o - continue to online mode' print 'c - convert .pkm files to newer gens' print 'q - quit\n' print '\nPlease type your option, and press Enter\n' choice = raw_input().strip().lower() if choice.startswith('a'): clear() statana() elif choice.startswith('o'): clear() print '\nContinuing to online menu...\n\n' break elif choice.startswith('c'): threetofour() elif choice.startswith('q'): clear() print 'Quitting program' cleanexit() else: print 'Invalid option, please try again.' continue print 'Returning to menu...\n'
def onlinemenu(): while True: print '\nChoose an option:' print 's - send pkm file to game' print 'r - receive Pokemon from game' print 'm - receive multiple Pokemon from game' print 'a - analyze pkm file' print 'q - quit\n' print '\nPlease type your option, and press Enter\n' option = raw_input().strip().lower() if option.startswith('s'): clear() sendmenu() elif option.startswith('r'): clear() getpkm() elif option.startswith('m'): clear() print 'Press ctrl + c to return to main menu' while True: try: getpkm() except KeyboardInterrupt: break elif option.startswith('a'): clear() statana() elif option.startswith('q'): clear() print 'Quitting program' cleanexit() else: print 'Invalid option, try again' continue print 'Returning to main menu...'
def main(): global SHOWOUTPUT if len(sys.argv) > 1: try: SHOWOUTPUT = [False, True][int(sys.argv[1])] except: print("Show output on/off specified by 0/1") sys.exit(1) clear() players = [LearnBot(), LearnBot(), LearnBot(), LearnBot()] for i in range(len(players)): players[i].name += str(i) for i in range(len(players), 4): name = input("Enter player " + str(i + 1) + "\'s name: ") players.append(Player(name, False)) print("") print("Welcome to \'Oh Well\'") #time.sleep(3) clear() startGame(players)
def main(): s = system() if s == 'Darwin' or s == 'Linux': if os.getuid() != 0: print 'Program must be run as superuser. Enter your password below' + \ ' if prompted.' os.system('sudo ' + argv[0] + ' root') exit(0) print "\n", gtsvar.version, "\n" if gtsvar.stable == 'no': print "===============================================" print "EXPERIMENTAL/UNSTABLE VERSION! MIGHT HAVE BUGS!" print "===============================================\n" offlinemenu() initServ() sleep(1) done = False onlinemenu() if __name__ == "__main__": try: clear() main() except KeyboardInterrupt: cleanexit()
def startGame(players): deck = Deck() scores = [0, 0, 0, 0] for handCount in range(1, 26): hand = handCount if handCount < 14 else 26 - handCount leading = hand % 4 won = leading #Shuffle the deck deck.shuffle() #Deal the cards for dealing in range(hand): for player in players: player.deal(deck, deck.cards[0]) #Display scores clear() for i in range(4): cols = [ Fore.GREEN, Fore.LIGHTGREEN_EX, Fore.LIGHTYELLOW_EX, Fore.YELLOW ] print(cols[i] + players[i].name + ": " + str(scores[i]), end=" ") print(Style.RESET_ALL + "") #Determine trump suit trump = deck.getTrump() fores = [Fore.RED, Fore.BLACK] if SHOWOUTPUT: print("\nTrump is " + fores[SUITS.index(trump) % 2] + Back.WHITE + trump + " " + Style.RESET_ALL) #Make bets bets = [] tricks = [0, 0, 0, 0] if SHOWOUTPUT: print("\n" + players[leading].name + " leads\n") for player in players: i = players.index(player) if isinstance(player, Bot): bets.append(player.bet(hand - 1, trump, i == 0)) else: bets.append(player.bet()) for player in players: if SHOWOUTPUT: print(player.name + " bets " + str(bets[players.index(player)]), end=" ") if SHOWOUTPUT: print("\n") #Play hand for trick in range(hand): table = [] for i in range(4): index = (i + won) % 4 played = players[index].play(table, trump, 0, bets[index]) players[index].hand.remove(played) table.append(played) if SHOWOUTPUT: print(players[index].name + " plays " + str(played)) winner = (getWinner(table, trump) + won) % 4 if SHOWOUTPUT: print("\n" + players[winner].name + " wins\n") won = winner tricks[winner] += 1 #Cleanup table, cards go back to deck while len(table) > 0: deck.cards.append(table[0]) table.remove(table[0]) for i in range(4): scores[i] += tricks[i] if tricks[i] == bets[i]: scores[i] += 5 input("Press Enter to continue to next hand")