def create_world(): global pikachu, map, clouds, ball, score, waves, AI pikachu = Pikachu() map = Map() ball = Ball() score = Score() waves = [Wave() for i in range(28)] clouds = [Cloud() for i in range(15)] for i in range(28): waves[i].x = i * 16 AI = Ai()
from Board import Board from Player import Player from AI import Ai from Moderator import Mod if __name__ == "__main__": # instantiating board board = Board() # instantiating player playerName = "Casper" playerSymbol = "X" player = Player(playerName, playerSymbol, board) # instantiating AI aiName = "Mike Hunt" aiSymbol = "O" ai = Ai(aiName, aiSymbol, board, player) # instantiating moderator banner = "new_tttBanner.txt" mod = Mod(board, player, ai, banner) mod.welcomeMessage() while not mod.determineWinner(): mod.requestMove() if mod.checkDraw(): break
def testMove2(self, input): ai = Ai() ai.run() self.assertEqual(ai.getLastOutput(), "move forward forward")
def computerturn(self): self.setcurrentboard() gamedetails = Ai(gamematrix=self.gamematrix, compchar=self.compchar, compstart=self.compstart, playchar=self.playerchar).move() return gamedetails
level = [["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "red", "red", "gray", "gray"], ["gray", "gray", "red", "red", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["blue", "gray", "gray", "gray", "gray", "blue"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"], ["gray", "gray", "gray", "gray", "gray", "gray"] ] ai = Ai() class Minion(): def __init__(self, i,p, x,y, win): # self.i = i; self.x = x; self.y = y; self.oldx = x; self.oldy = y; self.dx = 0; self.dy = 0; #print(p) #self.color = json.loads(p).get("color"); self.color = p p = Point(self.x, self.y) self.body = Circle(p, 20) # set center and radius