-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyOwnAgentStones.py
30 lines (26 loc) · 1.2 KB
/
MyOwnAgentStones.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from MyAgent import MyAgent
from MyAgentStones import MyAgentStones
from Board import Board
from Board import Color
import pygame
#inherits MyAgent
class MyOwnAgentStones(MyAgentStones):
def __init__(self, id, initX, initY, env, backPack):
super().__init__(id, initX, initY, env, backPack)
self.local_plan = []
self.color = Color.STONE
self.evaluating_from = self.posX, self.posY
self.evaluating_with_load = 0
self.evaluating_dist_so_far = 0
self.roaming_around_directions = [[-1, 0], [0, 1], [1, 0], [0, -1]]
self.currendt_dir = 0
self.font = Board.get_instance().agents_font
pygame.init()
def draw(self, screen, cell_size):
pygame.draw.circle(screen, Color.WHITE, (self.posY * cell_size + cell_size//2, self.posX * cell_size + cell_size//2), cell_size//3+2)
circ = pygame.draw.circle(screen, self.color, (self.posY * cell_size + cell_size//2, self.posX * cell_size + cell_size//2), cell_size//3)
text = str(self.stone)
text_surface = self.font.render(text, True, Color.WHITE)
text_rect = text_surface.get_rect()
text_rect.center = circ.center
screen.blit(text_surface, text_rect)