Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrikest committed Jun 5, 2019
1 parent 0e63570 commit 88edc74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion DRL_Snakey/core/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def next_step(self, direction):
self.ate += 1
self.isfood = False
is_ate = True
if self.ate == 397: # 吃满,游戏结束
self.deathflag = True
if not self.isfood: # 根据食物判定刷新食物
self.food_pos = (randint(0, PLAYGROUND_WIDTH - 1), randint(0, PLAYGROUND_HEIGHT - 1))
while self.food_pos in self.main_snake.snakes or self.food_pos in self.bombs: # 避免重叠刷新
Expand All @@ -100,7 +102,7 @@ def next_step(self, direction):
if (self.main_snake.head_pos[0], self.main_snake.head_pos[1]) in self.bombs: # 炸弹碰撞检测
self.deathflag = True
self.step += 1
if self.step > 10000:
if self.step == 10000:
self.step = 0
return is_ate

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
long_description = fh.read()
setup(
name = "DRL_Snakey",
version = "1.1.1r",
version = "1.2",
description = "A Deep Reinforcement Learning study package. With game environment.",
long_description = long_description,
long_description_content_type = "text/markdown",
Expand Down

0 comments on commit 88edc74

Please sign in to comment.