added in code new tiles and used random generate_field method
This commit is contained in:
parent
348ed31774
commit
df796c0842
@ -7,7 +7,8 @@ WIDTH = 800
|
|||||||
HEIGHT = 800
|
HEIGHT = 800
|
||||||
|
|
||||||
IMAGES = []
|
IMAGES = []
|
||||||
for img in ['grass_01', 'grass_02', 'grass_mine_01', 'grass_mine_02', 'grass_rock_01', 'grass_rock_02']:
|
for img in ['grass_01', 'grass_02', 'grass_mine_01', 'grass_mine_02', 'grass_rock_01','grass_mine_02a','grass_mine_02a',
|
||||||
|
'grass_mine_02b','grass_mine_03a','grass_rock_02']:
|
||||||
IMAGES.append(image.load(main_path + 'images/Tiles/' + img + ".png"))
|
IMAGES.append(image.load(main_path + 'images/Tiles/' + img + ".png"))
|
||||||
|
|
||||||
ICON = main_path + 'images/mine_icon.png'
|
ICON = main_path + 'images/mine_icon.png'
|
||||||
|
@ -3,7 +3,7 @@ from random import choices
|
|||||||
|
|
||||||
|
|
||||||
def generate_field() -> List[List[int]]:
|
def generate_field() -> List[List[int]]:
|
||||||
return [choices(range(6), weights=[8, 8, 4, 4, 4, 4], k=10) for _ in range(10)]
|
return [choices(range(9), weights=[8, 8, 4, 4, 4, 4,4,4,4], k=10) for _ in range(10)]
|
||||||
|
|
||||||
|
|
||||||
class Environment:
|
class Environment:
|
||||||
|
@ -4,7 +4,7 @@ from const import ICON
|
|||||||
from agent import Agent
|
from agent import Agent
|
||||||
from game_ui import GameUi
|
from game_ui import GameUi
|
||||||
from const import DEFAULT_FIELD
|
from const import DEFAULT_FIELD
|
||||||
from environment import Environment
|
from environment import Environment,generate_field
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -12,7 +12,7 @@ def main():
|
|||||||
pg.display.set_caption('Super Saper')
|
pg.display.set_caption('Super Saper')
|
||||||
pg.display.set_icon(pg.image.load(ICON))
|
pg.display.set_icon(pg.image.load(ICON))
|
||||||
|
|
||||||
env = Environment(DEFAULT_FIELD)
|
env = Environment(generate_field())
|
||||||
agent = Agent()
|
agent = Agent()
|
||||||
game_ui = GameUi(agent, env)
|
game_ui = GameUi(agent, env)
|
||||||
game_ui.update()
|
game_ui.update()
|
||||||
|
Loading…
Reference in New Issue
Block a user