Project: Autonomous Creatures Part 1

So, I decided to try out that idea I had a few posts ago, combining both neural networks and genetic algorithms. This is gonna be pretty complicated, if it works, so I’m gonna break it down into smaller portions to do.

Today, I didn’t do much. I basically set up everything, plopped a square thing in the centre as the creature, and thought about how it would move and scan the field for food/enemies.

Using a bit of maths, I think I can divide the playing field into 16 areas which would then be scanned and then the distance for each object could be calculated pretty easily. This info would then be fed into the neural net for it to do whatever it does.

Behold, my artistic masterpiece…

My artistic masterpiece...

Anything further on, I still haven’t decided on. But here’s the code so far:

import pygame, sys
from pygame.locals import *


FPS = 100
fpsClock = pygame.time.Clock()

DISPLAYSURF = pygame.display.set_mode((600, 600))

WHITE = (255, 255, 255)

creature = Rect(0, 0, 20, 20)
critx = 300
crity = 300 = (critx, crity)

while True:
    pygame.draw.rect(DISPLAYSURF, (0,0,0), creature)

    for event in pygame.event.get():
        if event.type == QUIT:


And here’s what it looks like right now, a lone square in the centre in the abyss:

And here's what it looks like right now, a lone square in the centre in the abyss.