added in code new tiles and used random generate_field method

This commit is contained in:
piowyg 2021-03-16 20:00:10 +01:00
parent 348ed31774
commit df796c0842
4 changed files with 5 additions and 4 deletions

0
git Normal file
View File

View File

@ -7,7 +7,8 @@ WIDTH = 800
HEIGHT = 800
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"))
ICON = main_path + 'images/mine_icon.png'

View File

@ -3,7 +3,7 @@ from random import choices
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:

View File

@ -4,7 +4,7 @@ from const import ICON
from agent import Agent
from game_ui import GameUi
from const import DEFAULT_FIELD
from environment import Environment
from environment import Environment,generate_field
def main():
@ -12,7 +12,7 @@ def main():
pg.display.set_caption('Super Saper')
pg.display.set_icon(pg.image.load(ICON))
env = Environment(DEFAULT_FIELD)
env = Environment(generate_field())
agent = Agent()
game_ui = GameUi(agent, env)
game_ui.update()