The Inbox: EToys-kfr.378.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: EToys-kfr.378.mcz

commits-2
A new version of EToys was added to project The Inbox:
http://source.squeak.org/inbox/EToys-kfr.378.mcz

==================== Summary ====================

Name: EToys-kfr.378
Author: kfr
Time: 18 January 2020, 7:45:20.675611 pm
UUID: a01d56e9-8ac1-b544-aa6b-a594e325389e
Ancestors: EToys-kfr.377

Refactoring Mines levels and hi score enhancement

=============== Diff against EToys-kfr.377 ===============

Item was changed:
  AlignmentMorph subclass: #Mines
+ instanceVariableNames: 'board minesDisplay timeDisplay helpText level levelButton hiScoreDisplay'
- instanceVariableNames: 'board minesDisplay timeDisplay helpText level levels levelButton hiScoreDisplay'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Etoys-Squeakland-Morphic-Games'!

Item was changed:
  ----- Method: Mines class>>initialize (in category 'parts bin') -----
  initialize
  super initialize.
       "boardSizes are column, row, mines, highScore"
  BoardSizes := Dictionary new.
+ BoardSizes at: 1 put:{8. 8. 10. 999. 'Beginner'}.
+       BoardSizes at: 2 put:{16. 16. 40. 999. 'Intermediate'}.
+       BoardSizes at: 3 put:{30. 16. 99. 999. 'Expert'}.
- BoardSizes at: 'Expert' put:{30. 16. 99. 999}.
-       BoardSizes at: 'Intermediate' put:{16. 16. 40. 999}.
-       BoardSizes at: 'Beginner' put:{8. 8. 10. 999}.
 
  !

Item was changed:
  ----- Method: Mines>>initialize (in category 'initialization') -----
  initialize
  "initialize the state of the receiver"
 
  super initialize.
+
+       level := 1.
- levels := {'Beginner'. 'Intermediate'. 'Expert'}.
-       level := levels first.
  self listDirection: #topToBottom;
   wrapCentering: #center;
  cellPositioning: #topCenter;
   vResizing: #shrinkWrap;
   hResizing: #shrinkWrap;
   layoutInset: 3;
   addMorph: self makeControls;
   addMorph: self board.
  helpText := nil.
 
  self newGame!

Item was changed:
  ----- Method: Mines>>newGame (in category 'actions') -----
  newGame
        | boardSize |
        boardSize := BoardSizes at: level.
  timeDisplay value: 0; flash: false.
  timeDisplay stop.
  timeDisplay reset.
  minesDisplay value: (boardSize at: 3).
  hiScoreDisplay value: (boardSize at: 4).
+ levelButton label: (boardSize at: 5) asString.
  self board resetBoard: level.!

Item was changed:
+ ----- Method: Mines>>nextLevel (in category 'actions') -----
- ----- Method: Mines>>nextLevel (in category 'access') -----
  nextLevel
+       level := level + 1.
+       level = 4 ifTrue:[level := 1].
-       | nextLevel |
-       nextLevel := (levels indexOf:level) + 1.
-       nextLevel = 4 ifTrue:[nextLevel := 1].
- level := levels at:(nextLevel).
- levelButton label: level asString.
  self newGame
 
  !

Item was changed:
  ----- Method: MinesBoard>>initialize (in category 'initialization') -----
  initialize
  "initialize the state of the receiver"
  super initialize.
  ""
  target := nil.
  actionSelector := #selection.
  arguments := #().
  ""
  self layoutPolicy: nil;
   hResizing: #rigid;
   vResizing: #rigid.
  ""
+ boardSize := BoardSizes at: 1.
- boardSize := BoardSizes at:'Beginner'.
 
  columns := self preferredColumns.
  rows  := self preferredRows.
  flashCount := 0.
  ""
  self extent: self protoTile extent * (columns @ rows).
  self adjustTiles.
+ self resetBoard: 1.!
- self resetBoard: 'Beginner'.!