def initializeVersusAIVariables(): global playerOne global playerTwo global current global nextMove global board global agent P1 = 0 P2 = 1 # multiprocess computaion print "board", agent board = mancala_board.Board() playerOne = Human(P1) # ai Player print agent, 'sdddddddddddddddddddddddddddd' if agent == "Minimax": playerTwo = minimax.AI(P2, 8) elif agent == "Genesis": playerTwo = genesis.genesis(P2, 3) elif agent == "MonteCarlo": playerTwo = mcts.MCTS(P2, mancala_board.Board()) print "Versus AI Agent:", agent # starting player is random # current = random.randint(0,1) # todo this line is a f*****g problem...... current = None nextMove = random.randint(0,1) return jsonify({'initialized' : True})
def main(): Parameters = [] Parameters.append(float( sys.argv[1])) #I - Percentage Probable (PP) Infectivity Parameters.append(int(sys.argv[2])) #InfP - Mean (M) Infectious Period Parameters.append(float(sys.argv[3])) #Mob - PP Mobility Parameters.append(int(sys.argv[4])) #IncP - M Incubation Period Parameters.append(float(sys.argv[5])) #Mor - PP Mortality Parameters.append(float(sys.argv[6])) #Imn - PP Immunity Parameters.append(int(sys.argv[7])) #RecP - M Recovery Period PImmune = 0.0 #Pre-Immune can also be viewed as Population Density xDimension = int(sys.argv[8]) yDimension = int(sys.argv[9]) tElapsed = int(sys.argv[10]) move_range = float(sys.argv[11]) #PP of switching places PLOT = sys.argv[12] I = Parameters[0] #Percentage InfP = range(int(Parameters[1]) - 3, int(Parameters[1]) + 4) Mob = Parameters[2] #Percentage IncP = range(int(Parameters[3]) - 3, int(Parameters[3]) + 4) Mor = Parameters[4] #Percentage Imn = Parameters[5] #Percentage RecP = range(int(Parameters[6]) - 3, int(Parameters[6]) + 4) Population = xDimension * yDimension Dossier, Record, Pos2Pat, ID = genesis.genesis(Parameters, xDimension, yDimension) Trends = genesis.initial() for t in range(tElapsed): if len(sys.argv) >= 13: plot.matrix(Dossier, Population, t) for P in range(1, ID + 1): status.StatusUpdate(Dossier, Record, Pos2Pat, xDimension, yDimension, P, Mob, I, Imn, Mor) flux.flux(xDimension, yDimension, Pos2Pat, Dossier, move_range) plot.update(Dossier, Trends, ID, t) print Pos2Pat Record = copy.deepcopy(Dossier) if len(sys.argv) >= 13: plot.plotTrend(Trends) plot.Print(Dossier, ID, Population)
elif args.rd == "sf": if (args.file == "console"): print( "must specify a local --FILE to write the serial flash file's contents into" ) else: umd = umd(cartType) umd.sfReadFile(args.sfile, args.file) print("read {0} from serial flash to {1} in {2:.3f} s".format( args.sfile, args.file, umd.opTime)) # read the ROM header of the cartridge, output formatted in the console elif args.rd == "header": # Genesis Header if args.mode == "gen": genesis = genesis() # header from file or from UMD? if args.file != "console": extractHeader(genesis.headerAddress, genesis.headerSize, args.file, "_header.bin") else: umd = umd(cartType) umd.read(genesis.headerAddress, genesis.headerSize, args.rd, "_header.bin") # display for item in sorted( genesis.formatHeader("_header.bin").items()): print(item) # cleanup try: os.remove("_header.bin")