Beispiel #1
0
 def do_train(self, line):
     if line=="agent":
         starttraining(TrainableAgent(namegen.createName()))
     elif line == "medic":
         starttraining(TrainableMedic(namegen.createName()))
     elif line == "droid":
         starttraining(TrainableDroid())
     else:
         print "train who?"
Beispiel #2
0
    print "they:", sideB    


def play(A, B):
    while A !=[] and B != []:
        # randomly choose player1 and 2
        step(A, B)


if __name__ == "__main__":
    loud = True
    sideA = []
    while True:
        sideB = [AngryAnt("ant") for i in range(10)] 
        while len(sideA) < 5:
            name = namegen.createName()
            if random.random()< 0.2:
                unit = Healer(name)
            else:
                unit = Agent(name)    
            sideA.append(unit)
        print "side A is ready for next round"
        
        status()   
        while sideA !=[] and sideB != []:
            # randomly choose player1 and 2
            step(sideA, sideB)
            status()
            raw_input()
        for person in sideA:
            if person.wounded():