Adding CLICK_NAIVE event
This commit is contained in:
@@ -4,11 +4,14 @@ import random
|
||||
class Minesweeper:
|
||||
board = []
|
||||
|
||||
def __init__(self, rows=10, cols=10, mines=5):
|
||||
def __init__(self, rows=10, cols=10, mines=5, board=None):
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
self.mines = mines
|
||||
|
||||
if board is not None:
|
||||
self.board = board
|
||||
|
||||
def create_board(self):
|
||||
""" Creating the board cells with 0 as default value """
|
||||
self.board = [[0 for col in range(self.cols)] for row in range(self.rows)]
|
||||
|
||||
41
game/migrations/0004_auto_20201106_0453.py
Normal file
41
game/migrations/0004_auto_20201106_0453.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Generated by Django 3.1.3 on 2020-11-06 04:53
|
||||
|
||||
from django.db import migrations, models
|
||||
import game.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("game", "0003_gameevent"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="gameevent",
|
||||
options={
|
||||
"ordering": ["created_at"],
|
||||
"verbose_name": "Game event",
|
||||
"verbose_name_plural": "Game events",
|
||||
},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="gameevent",
|
||||
name="type",
|
||||
field=models.IntegerField(
|
||||
choices=[
|
||||
(0, "START_GAME"),
|
||||
(1, "PAUSE"),
|
||||
(2, "RESUME"),
|
||||
(3, "CLICK_MINE"),
|
||||
(4, "CLICK_POINT"),
|
||||
(5, "CLICK_EMPTY"),
|
||||
(6, "CLICK_FLAG"),
|
||||
(7, "GAME_OVER"),
|
||||
(8, "CLICK_NAIVE"),
|
||||
],
|
||||
default=game.models.EventTypes["START_GAME"],
|
||||
help_text="The game event",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -80,6 +80,7 @@ class EventTypes(EnumChoicesBase):
|
||||
CLICK_EMPTY = 5
|
||||
CLICK_FLAG = 6
|
||||
GAME_OVER = 7
|
||||
CLICK_NAIVE = 8
|
||||
|
||||
|
||||
class GameEvent(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user