first commit

This commit is contained in:
emil
2024-10-12 08:06:45 +03:00
commit 4d2e2bb52b
4 changed files with 84 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
/.idea
/.venv
/Graphs
/__pycache__
+45
View File
@@ -0,0 +1,45 @@
import numpy as np
class Entity:
position = np.array([0,0])
name = ""
def __init__(self, InitialPosition, name):
self.position = InitialPosition
self.name = name
class Actor(Entity):
perceptionRadius = 0
percievedCells = None
def __init__(self, InitialPosition, name, perceptionRadius):
super().__init__(InitialPosition, name)
self.perceptionRadius = perceptionRadius
class Neo(Actor):
keyMakerPosition = np.array([0,0])
def __init__(self, InitialPosition, perceptionRadius, keyMakerPosition):
super().__init__(InitialPosition, "Neo", perceptionRadius)
self.keyMakerPosition = keyMakerPosition
class Smith(Actor):
def __init__(self, InitialPosition, perceptionRadius):
super().__init__(InitialPosition, "Smith", perceptionRadius)
def Kill():
print("Neo is killed.") #TODO: delete
class Sentinel(Actor):
def __init__(self, InitialPosition, perceptionRadius):
super().__init__(InitialPosition, "Sentinel", perceptionRadius)
def Kill():
print("Neo is killed.") #TODO: delete
class Keymaker(Entity):
def __init__(self, InitialPosition):
super().__init__(InitialPosition, "Keymaker")
class BackdoorKey(Entity):
def __init__(self, InitialPosition):
super().__init__(InitialPosition, "BackdoorKey")
+14
View File
@@ -0,0 +1,14 @@
import pygame as pg
from map import *
cell = Cell(coordinates=np.array([50,50]))
running = True
while (running):
for event in pg.event.get():
if event.type == pg.QUIT:
running = False
screen.fill('BLACK')
cell.draw()
+21
View File
@@ -0,0 +1,21 @@
import numpy as np
import pygame as pg
screen = pg.display.set_mode([512,512])
pg.display.set_caption("Matrix Universe")
pg.init()
class Cell:
coordinates = np.array([0,0])
position = np.array([0,0])
size = 50
piece = pg.draw.rect(screen, (255,255,255), (0, 0, size, size))
def __init__(self, coordinates):
self.coordinates = coordinates
self.position = coordinates // self.size
def draw(self):
screen.blit(screen, self.coordinates ,self.piece)
class Map:
cellGrid = None
def __init__(self):
pass