fix choices range and weights, change defusing the condition
This commit is contained in:
parent
62af2ec7f4
commit
d664576a22
@ -3,7 +3,7 @@ from random import choices
|
||||
|
||||
|
||||
def generate_field() -> List[List[int]]:
|
||||
return [choices(range(9), weights=[8, 8, 4, 4, 4, 4, 4, 4, 4], k=10) for _ in range(10)]
|
||||
return [choices(range(11), weights=[10, 10, 4, 4, 4, 4, 4, 4, 4, 4, 4], k=10) for _ in range(10)]
|
||||
|
||||
|
||||
class Environment:
|
||||
|
@ -1,9 +1,9 @@
|
||||
import pygame as pg
|
||||
|
||||
from const import ICON
|
||||
from agent import Agent
|
||||
from game_ui import GameUi
|
||||
from environment import Environment
|
||||
from const import ICON, IMAGES_MAPPING
|
||||
|
||||
|
||||
def main():
|
||||
@ -31,8 +31,8 @@ def main():
|
||||
elif event.key == pg.K_w and agent.y*80 > 0:
|
||||
game_ui.move('y', -1)
|
||||
elif event.key == pg.K_SPACE:
|
||||
if env.field[agent.y][agent.x] in [2, 3]:
|
||||
env.field[agent.y][agent.x] -= 2
|
||||
if env.field[agent.y][agent.x] > 3:
|
||||
env.field[agent.y][agent.x] = IMAGES_MAPPING[env.field[agent.y][agent.x]]
|
||||
game_ui.update()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user