コード例 #1
0
def execute():
    Player.manufactureLists()
    playerNumber = input("How many players do you want? \n")
    for i in range(0,int(playerNumber)):
        name = input("His name?")
        playerList.append(p(name))
        
    count = 0
    while (len(playerList) > 1):
        index = count%len(playerList)
        print("Player " , index + 1 , " is up with health ", playerList[index].getHealth(), end = "\n")
        print("It has moves" , playerList[index].getMoves())
        ''' find  a way to append a message onto the prompt displayed using input''' 
        prompt = "Choose an index of the move you'd like to use from 1-" + str(len(playerList[index].getMoves()))
        move = int(input(prompt))
        print(playerList)
        prompt = "And then choose the opponent you would like to attack from 1-" + str(len(playerList)) + "amongst" + str(playerList)
        opponent = int(input(prompt))
        dealDamage(playerList[index], move-1, playerList[opponent-1])
        updatePlayerList()
        count += 1
        
    print("Game Over: ", playerList , " wins!" )
コード例 #2
0
'''
Created on Oct 24, 2015

@author: ahanagrawal
'''
from NewChapter1_KLamb.PokemonGame import Player

if __name__ == "__main__":
    
    Player.manufactureLists()
    l = list()
    for i in range(0,5):
        for j in range(0,4):
            l.append(Player("F"));
            print ("Trial #" + j+1 , l[j].getList())
        print("\n")
        l = list()