예제 #1
0
#Import modules
import random
import IntelligentAgent as ai
import World
import pygame
import sys

#Game
pygame.init()

#Screen informations
width = 800
height = 600
screen = pygame.display.set_mode((width, height))
turbo = False
world = World.virtual_world(32, 32)
foodspawn = 0
foodfreq = 3
spikespawn = 0
spikefreq = 3
agent = ai.IntelligentAgent(5000, 0.01, 0.8, 0.9) 
agent_x = random.randint(0, world.width-1)
agent_y = random.randint(0, world.height-1)
reward = 0.0
cumulativereward = 0.0
mediumreward = 0.0
totalreward = 0.0
world.place_object(3, agent_x, agent_y)

#Font for text
font = pygame.font.SysFont("Monaco", 18)