main logo
Subject: [dabo-dev] dabodemo Commit 279
Author: Paul McNett

Posted: 2005/08/31 18:23:01
 
View Entire Thread
New Search


dabodemo Commit
Revision 279
Date: 2005-08-31 16:32:07 -0700 (Wed, 31 Aug 2005)
Author: paul

Changed:
U trunk/minesweeper.py
UU trunk/montana.py

Log:
Added executable flag to montana, and put some extra linefeeds
into the help text.

Followed montana's lead and put a help dialog into minesweeper.


Diff:
Modified: trunk/minesweeper.py
===================================================================
--- trunk/minesweeper.py 2005-08-31 21:18:03 UTC (rev 278)
+++ trunk/minesweeper.py 2005-08-31 23:32:07 UTC (rev 279)
@@ -1,4 +1,20 @@
#!/usr/bin/env python
+
+"""Dabo Minesweeper
+
+How To Play
+
+Use your mouse button to clear a square. If the square was a mine,
+you lose. Otherwise, a number will appear telling you how many
+adjacent squares have mines. Use your right mouse button (Linux and
+Windows) or Control+Click (Mac) to mark a square. Successive clicks
+will change the mark from a ' .at. ' (flagged as a mine), to a '?' (a
+helpful marker for your own use in solving the puzzle) and then
+back to a blank square (ready to clear) D.OT
+
+You win when all squares are either flagged as mines or cleared.
+"""
+
import datetime
import random
import dabo.db
@@ -557,6 +573,26 @@
self.board.showAllSquares()
self.board._GameInProgress = False

+ def onRules(self, evt):
+ win = dabo.ui.dDialog(self, NameBase="frmRulesDialog",
+ Caption="Minesweeper Rules", SaveUserGeometry=True,
+ Centered=True, Modal=False)
+ pnl = dabo.ui.dScrollPanel(win)
+ win.Sizer.append1x(pnl)
+ txt = dabo.ui.dLabel(pnl, Caption=__doc__)
+ sz = dabo.ui.dSizer("v")
+ sz.append1x(txt, border=10)
+ pnl.Sizer = sz
+ win.layout()
+ pnl.fitToSizer()
+ win.Visible = True
+
+ # Not real sure why the dialog doesn't release itself upon Close, but
+ # the following handles that until I figure it out:
+ def onClose(evt):
+ win.release()
+ win.bindEvent(dEvents.Close, onClose)
+
def newGame(self):
bs = self.board.BoardSize
mc = self.board.MineCount
@@ -576,6 +612,10 @@
fileMenu.prepend(_("&New Game\tCtrl+N"), help=_("Start a new game"),
bindfunc=self.onNewGame, bmp="new")

+ helpMenu = mb.getMenu(_("Help"))
+ helpMenu.append(_("&How to Play\tCtrl+I"), help=_("Rules of the game"),
+ bindfunc=self.onRules, bmp="info")
+
tb = self.ToolBar = dabo.ui.dToolBar(self)
tb.appendButton("New", pic="new", toggle=False, bindfunc=self.onNewGame,
tip="New Game", help="Start a new game")

Modified: trunk/montana.py
===================================================================
--- trunk/montana.py 2005-08-31 21:18:03 UTC (rev 278)
+++ trunk/montana.py 2005-08-31 23:32:07 UTC (rev 279)
@@ -15,9 +15,11 @@
by the card to the immediate left of the gap. The moved card must be
the same suit, and one rank higher. Example: if there is a gap, and the
card to left of it is 4C, only 5C can be moved to the gap.
+
If the gap is located in the leftmost column, any 2 card can be moved
there. If the card to the left of the gap is a King, no card can be moved
there.
+
When all 4 gaps are located to the right of Kings, no further moves are
possible, and the hand ends. If there are any re-deals remaining, the
cards are re-dealt, and another hand is played. When all re-deals are


Property changes on: trunk/montana.py
___________________________________________________________________
Name: svn:executable
+ *





 
©2005 Paul McNett
<-- Prior Message New Search Next Message -->