예제 #1
0
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()
예제 #2
0
파일: main.py 프로젝트: kaz1m1r/TicTacToeAI
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

예제 #3
0
 def testMove2(self, input):
     ai = Ai()
     ai.run()
     self.assertEqual(ai.getLastOutput(), "move forward forward")
예제 #4
0
 def computerturn(self):
     self.setcurrentboard()
     gamedetails = Ai(gamematrix=self.gamematrix, compchar=self.compchar, compstart=self.compstart, playchar=self.playerchar).move()
     return gamedetails
예제 #5
0
파일: UI2D.py 프로젝트: AIeq/craftspring
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