#因贴吧自动吃掉空格。复制代码后,需替换空白字符为空格
import wx
from random import random
bombsID_NEWGAME = wx.ID_HIGHEST
bombsID_EASY = wx.ID_HIGHEST + 1
bombsID_MEDIUM = wx.ID_HIGHEST + 2
bombsID_HARD = wx.ID_HIGHEST + 3
BG_HIDDEN = 0x100
BG_BOMB = 0x200
BG_MARKED = 0x400
BG_EXPLODED = 0x800
BG_MASK = 0x0FF
PROB = 0.2
X_UNIT = 4
Y_UNIT = 4
class BombsGame:
def __init__ (self):
self.m_width = 0
self.m_height = 0
self.m_field = 0
def Init (self, aWidth, aHeight):
self.m_gridFocusX = -1
self.m_gridFocusY = -1
try:
if self.m_field:
self.m_field = []
except:
pass
self.m_field = aWidth * aHeight*[0]
self.m_width = aWidth
self.m_height = aHeight
for x in range (0, self.m_width):
for y in range (0, self.m_height):
if random() < PROB:
self.m_field [x + y * self.m_width] = BG_HIDDEN | BG_BOMB
import wx
from random import random
bombsID_NEWGAME = wx.ID_HIGHEST
bombsID_EASY = wx.ID_HIGHEST + 1
bombsID_MEDIUM = wx.ID_HIGHEST + 2
bombsID_HARD = wx.ID_HIGHEST + 3
BG_HIDDEN = 0x100
BG_BOMB = 0x200
BG_MARKED = 0x400
BG_EXPLODED = 0x800
BG_MASK = 0x0FF
PROB = 0.2
X_UNIT = 4
Y_UNIT = 4
class BombsGame:
def __init__ (self):
self.m_width = 0
self.m_height = 0
self.m_field = 0
def Init (self, aWidth, aHeight):
self.m_gridFocusX = -1
self.m_gridFocusY = -1
try:
if self.m_field:
self.m_field = []
except:
pass
self.m_field = aWidth * aHeight*[0]
self.m_width = aWidth
self.m_height = aHeight
for x in range (0, self.m_width):
for y in range (0, self.m_height):
if random() < PROB:
self.m_field [x + y * self.m_width] = BG_HIDDEN | BG_BOMB

