Esempio n. 1
0
    print flatgrid
    bot.update([(l,v) for (l,v) in flatgrid if v > 0]) # cheat! tell bot everything

    s = pygame.Surface((side,side)) 
    s.set_alpha(128)            
    # draw sensor
    s.fill((125,125,125))
    for (x,y) in sensor:
        pygame.display.get_surface().blit(s, (x*side,y*side))
    # draw bot
    s.fill((0,0,255))
    pygame.display.get_surface().blit(s, (bx*side,by*side))

    # move bot for next update
    moveRate = 1
    botmovecount += 1
    if botmovecount%moveRate == 0:
        botmovecount = 1
        #bot.update(surr)  # tell bot what's up
        m = bot.getNextMove()
        if m:
            bot.setLoc((bx+m[0], by+m[1]))
        

    clock.tick(20)
    pygame.display.flip()
     
# Be IDLE friendly. If you forget this line, the program will 'hang'
# on exit.
pygame.quit ()