project_game/mine_spawner.py

20 lines
564 B
Python

# mine_spawner.py
# ------------
# By Cory
# This module defines a mine spawner agent class. It spawns mines!
from random import randint
from mine import Mine
class MineSpawner:
display = False
def __init__(self, board_size):
width, height = board_size
self.board_width, self.board_height = width, height
def play_turn(self, game):
if game.turn_number == 1:
mine = Mine(((randint(0, self.board_width - 1)),(randint(0, self.board_height - 1))))
game.log(mine.position)
game.add_agent(mine)