diff --git a/src/ComputationalArt/CADisplay.class.st b/src/ComputationalArt/CADisplay.class.st index f7cfa6e..bbfda64 100644 --- a/src/ComputationalArt/CADisplay.class.st +++ b/src/ComputationalArt/CADisplay.class.st @@ -114,7 +114,7 @@ CADisplay >> initialize [ { #category : #accessing, - #'squeak_changestamp' : 'KoPa 7/12/2024 20:30' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CADisplay >> showGrid: aGrid [ @@ -132,7 +132,7 @@ CADisplay >> showGrid: aGrid [ 1 to: rows do: [:rowIndex | 1 to: cols do: [:colIndex | - cell := aGrid getCellAtRow: rowIndex andCol: colIndex. + cell := aGrid cellAtRow: rowIndex andCol: colIndex. cellMorph := Morph new extent: size @ size; borderColor: Color black; @@ -145,7 +145,7 @@ CADisplay >> showGrid: aGrid [ { #category : #functional, - #'squeak_changestamp' : 'KoPa 7/12/2024 20:31' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CADisplay >> step [ @@ -166,7 +166,7 @@ CADisplay >> step [ do: [:rowIndex | (1 to: cols) do: [:colIndex | - cell := aGrid getCellAtRow: rowIndex andCol: colIndex. + cell := aGrid cellAtRow: rowIndex andCol: colIndex. cellMorph := CACellMorph new extent: size @ size; borderColor: Color gray; color: (blockLookup colorAt: cell); @@ -182,7 +182,7 @@ CADisplay >> step [ do: [:rowIndex | (1 to: cols) do: [:colIndex | - cell := aGrid getCellAtRow: rowIndex andCol: colIndex. + cell := aGrid cellAtRow: rowIndex andCol: colIndex. cellMorph := cells at: rowIndex - 1 * rows + colIndex. cellMorph color: (blockLookup colorAt: cell).]]]. diff --git a/src/ComputationalArt/CAGrid.class.st b/src/ComputationalArt/CAGrid.class.st index c5d75e2..878e827 100644 --- a/src/ComputationalArt/CAGrid.class.st +++ b/src/ComputationalArt/CAGrid.class.st @@ -65,141 +65,137 @@ CAGrid class >> fillTNT: aGrid [ ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'HaMa 5/31/2024 13:38' + #category : #constants, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:51' +} +CAGrid class >> size [ + "I return the num of rows and cols" + + ^ 100. +] + +{ + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' +} +CAGrid >> cellAtRow: aRow andCol: aCol [ + + ^ grid at: aRow at: aCol. +] + +{ + #category : #copy, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGrid >> deepcopy [ - |clone| + + | clone | clone := CAGrid new. 1 to: numRows do: [:rowIndex | - 1 to: numCols do: [: colIndex| - "grid at: rowIndex at: colIndex put: 10 * rowIndex + colIndex." - clone putCell: (grid at: rowIndex at: colIndex) atRow: rowIndex andCol: colIndex. - ]. - ]. - ^ clone + 1 to: numCols do: [:colIndex | + clone putCell: (grid at: rowIndex at: colIndex) atRow: rowIndex andCol: colIndex.]]. + ^ clone. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 5/29/2024 23:51' + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } -CAGrid >> getCellAtRow: row andCol: col [ +CAGrid >> grid [ - ^grid at: row at: col + ^ grid. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 5/30/2024 13:43' + #category : #'initialize-release', + #'squeak_changestamp' : 'KoPa 7/12/2024 23:51' } -CAGrid >> getNeighborsOfCellAtRow: row andCol: col [ - "get the 3x3 of cells surrounding a certain input" - |neighborMatrix temp gridRow gridCol| +CAGrid >> initialize [ + + numCols := CAGrid size. + numRows := CAGrid size. + + grid := Matrix rows: numRows columns: numCols. + + 1 to: numRows do: [:rowIndex | + 1 to: numCols do: [:colIndex | + grid at: rowIndex at: colIndex put: 0.]]. +] + +{ + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' +} +CAGrid >> neighborsOfCellAtRow: aRow andCol: aCol [ + + | neighborMatrix temp gridRow gridCol | neighborMatrix := Matrix rows: 3 columns: 3. - 1 to: 3 do: [:i | - 1 to: 3 do: [:j | - neighborMatrix at: i at: j put: 0. - ]. - ]. + 1 to: 3 do: [:row | + 1 to: 3 do: [:col | + neighborMatrix at: row at: col put: 0.]]. - (col=1) ifTrue: [ + aCol=1 ifTrue: [ neighborMatrix at: 1 at: 1 put: -1; at: 2 at: 1 put: -1; - at: 3 at: 1 put: -1. - ]. + at: 3 at: 1 put: -1.]. - (row=1) ifTrue: [ + aRow=1 ifTrue: [ neighborMatrix at: 1 at: 1 put: -1; at: 1 at: 2 put: -1; - at: 1 at: 3 put: -1. - ]. + at: 1 at: 3 put: -1.]. - (row=numRows) ifTrue: [ + aRow=numRows ifTrue: [ neighborMatrix at: 3 at: 1 put: -1; at: 3 at: 2 put: -1; - at: 3 at: 3 put: -1. - ]. + at: 3 at: 3 put: -1.]. - (col=numCols) ifTrue: [ + aCol=numCols ifTrue: [ neighborMatrix at: 1 at: 3 put: -1; at: 2 at: 3 put: -1; - at: 3 at: 3 put: -1. - ]. + at: 3 at: 3 put: -1.]. 1 to: 3 do: [:rowOffset | 1 to: 3 do: [:colOffset | temp := neighborMatrix at: rowOffset at: colOffset. - (temp == 0) ifTrue: [ - gridRow := row+rowOffset-2. - gridCol := col+colOffset-2. + (temp = 0) ifTrue: [ + gridRow := aRow+rowOffset-2. + gridCol := aCol+colOffset-2. temp := grid at: gridRow at: gridCol. - neighborMatrix at: rowOffset at: colOffset put: temp. - ]. - ]. - ]. + neighborMatrix at: rowOffset at: colOffset put: temp.]]]. - ^neighborMatrix + ^ neighborMatrix. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 6/16/2024 20:45' -} -CAGrid >> grid [ - - ^grid -] - -{ - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 6/7/2024 15:51' -} -CAGrid >> initialize [ - - numCols := 100. - numRows := 100. - - grid := Matrix rows: numRows columns: numCols. - - 1 to: numRows do: [:rowIndex | - 1 to: numCols do: [:colIndex | - grid at: rowIndex at: colIndex put: 0. - - ]. - ]. -] - -{ - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 6/16/2024 20:44' + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:51' } CAGrid >> numCols [ - ^numCols + ^ numCols. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 6/16/2024 20:45' + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:51' } CAGrid >> numRows [ - ^numRows + ^ numRows. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 5/30/2024 12:04' + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:52' } -CAGrid >> putCell: cell atRow: row andCol: col [ +CAGrid >> putCell: aCell atRow: aRow andCol: aCol [ - grid at: row at: col put: cell. + grid at: aRow at: aCol put: aCell. ] diff --git a/src/ComputationalArt/CAOverlay.class.st b/src/ComputationalArt/CAOverlay.class.st index e9470b1..1443035 100644 --- a/src/ComputationalArt/CAOverlay.class.st +++ b/src/ComputationalArt/CAOverlay.class.st @@ -17,26 +17,29 @@ CAOverlay class >> uiPosition [ ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'JAL 6/19/2024 15:16' + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:54' } CAOverlay >> game [ + ^ game. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'JAL 6/19/2024 15:13' + #category : #accessing, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:54' } CAOverlay >> game: aCAGame [ + game := aCAGame. ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'JAL 6/23/2024 17:19' + #category : #'initialize-release', + #'squeak_changestamp' : 'KoPa 7/12/2024 23:54' } CAOverlay >> initialize [ + | lastHeight menus | super initialize. menus := OrderedCollection new. diff --git a/src/ComputationalArt/CAOverlayBlockMenu.class.st b/src/ComputationalArt/CAOverlayBlockMenu.class.st index 75ed3f9..c29452c 100644 --- a/src/ComputationalArt/CAOverlayBlockMenu.class.st +++ b/src/ComputationalArt/CAOverlayBlockMenu.class.st @@ -5,15 +5,16 @@ Class { } { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'JAL 6/23/2024 17:30' + #category : #'initialize-release', + #'squeak_changestamp' : 'KoPa 7/12/2024 23:55' } CAOverlayBlockMenu >> initialize [ - | blockList | - + + | blockList s| super initialize. - - self addMorph: [|s| s := (CAOverlayListItem new) initialize. s contents: 'BlockMenu'. s] value. + self addMorph: + [s := (CAOverlayListItem new) initialize. + s contents: 'BlockMenu'. s] value. blockList := CAOverlayList new fromListOfStrings: #('Water' 'Sand' 'Stone' 'Air' 'TNT' 'Wood' 'Algae' 'Fire' 'Fish' 'Smoke'). diff --git a/src/ComputationalArt/CAOverlayItem.class.st b/src/ComputationalArt/CAOverlayItem.class.st index 42af199..1ebfaf7 100644 --- a/src/ComputationalArt/CAOverlayItem.class.st +++ b/src/ComputationalArt/CAOverlayItem.class.st @@ -5,11 +5,12 @@ Class { } { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'JAL 6/23/2024 15:00' + #category : #functional, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:54' } CAOverlayItem >> fitChildren [ - |originX originY cornerX cornerY| + + | originX originY cornerX cornerY | originX := 10000. originY := 10000. cornerX := 0. cornerY:= 0. self submorphsDo: [:s | s bounds corner x < originX ifTrue: [originX := s bounds origin x]]. @@ -24,7 +25,7 @@ CAOverlayItem >> fitChildren [ ] { - #category : #'as yet unclassified', + #category : #'initialize-release', #'squeak_changestamp' : 'JAL 6/23/2024 14:13' } CAOverlayItem >> initialize [ @@ -34,10 +35,11 @@ CAOverlayItem >> initialize [ ] { - #category : #'as yet unclassified', - #'squeak_changestamp' : 'JAL 6/23/2024 15:17' + #category : #functional, + #'squeak_changestamp' : 'KoPa 7/12/2024 23:54' } CAOverlayItem >> padding: aRectangle [ + self extent: (self extent + aRectangle origin + aRectangle corner). self submorphsDo: [:s | s position: (s position + aRectangle origin)] ] diff --git a/src/ComputationalArt/CARuler.class.st b/src/ComputationalArt/CARuler.class.st index a33eb51..97d11d7 100644 --- a/src/ComputationalArt/CARuler.class.st +++ b/src/ComputationalArt/CARuler.class.st @@ -9,7 +9,7 @@ Class { { #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 7/10/2024 14:41' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARuler >> applyRules: aRuleSet to: aGrid [ | aGridCopy cellNeighbors newCellNeighbors newCellVal | @@ -18,8 +18,8 @@ CARuler >> applyRules: aRuleSet to: aGrid [ aGridCopy := aGrid deepcopy. 1 to: aGrid numRows do: [:rowIndex | 1 to: aGrid numCols do: [:colIndex | - cellNeighbors := aGridCopy getNeighborsOfCellAtRow: rowIndex andCol: colIndex. - newCellNeighbors := aGrid getNeighborsOfCellAtRow: rowIndex andCol: colIndex. + cellNeighbors := aGridCopy neighborsOfCellAtRow: rowIndex andCol: colIndex. + newCellNeighbors := aGrid neighborsOfCellAtRow: rowIndex andCol: colIndex. newCellVal := rule applyRuleWith: cellNeighbors and: newCellNeighbors. aGrid putCell: newCellVal atRow: rowIndex andCol: colIndex ] @@ -29,7 +29,7 @@ CARuler >> applyRules: aRuleSet to: aGrid [ { #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 6/16/2024 20:45' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARuler >> printGrid: aGrid [ @@ -40,7 +40,7 @@ CARuler >> printGrid: aGrid [ 1 to: numRows do: [:i | 1 to: numCols do: [:j | - Transcript show: (aGrid getCellAtRow: i andCol: j) printString; space. + Transcript show: (aGrid cellAtRow: i andCol: j) printString; space. ]. Transcript cr. ]. diff --git a/src/ComputationalArtTests/CAGridTest.class.st b/src/ComputationalArtTests/CAGridTest.class.st index 22d818b..cb23e96 100644 --- a/src/ComputationalArtTests/CAGridTest.class.st +++ b/src/ComputationalArtTests/CAGridTest.class.st @@ -36,7 +36,7 @@ CAGridTest >> tearDown [ { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:55' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testClear [ @@ -50,12 +50,12 @@ CAGridTest >> testClear [ do: [:rowIndex | 1 to: numCols do: [:colIndex | - self assert: CABlocks air equals: (grid getCellAtRow: rowIndex andCol: colIndex).]]. + self assert: CABlocks air equals: (grid cellAtRow: rowIndex andCol: colIndex).]]. ] { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:55' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testDeepCopy [ @@ -69,17 +69,17 @@ CAGridTest >> testDeepCopy [ 1 to: numCols do: [:colIndex | self assert: - (copiedGrid getCellAtRow: rowIndex andCol: colIndex) + (copiedGrid cellAtRow: rowIndex andCol: colIndex) equals: - (grid getCellAtRow: rowIndex andCol: colIndex).]]. + (grid cellAtRow: rowIndex andCol: colIndex).]]. copiedGrid putCell:-1 atRow: 1 andCol: 1. - self assert: -1 < (grid getCellAtRow: 1 andCol: 1). + self assert: -1 < (grid cellAtRow: 1 andCol: 1). CAGrid clear: grid. ] { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:55' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testFillEmptyFail [ @@ -91,13 +91,13 @@ CAGridTest >> testFillEmptyFail [ do: [:rowIndex | 1 to: numCols do: [:colIndex | - self assert: CABlocks air equals: (grid getCellAtRow: rowIndex andCol: colIndex).]]. + self assert: CABlocks air equals: (grid cellAtRow: rowIndex andCol: colIndex).]]. CAGrid clear: grid. ] { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:55' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testFillStone [ @@ -109,13 +109,13 @@ CAGridTest >> testFillStone [ do: [:rowIndex | 1 to: numCols do: [:colIndex | - self assert: CABlocks stone equals: (grid getCellAtRow: rowIndex andCol: colIndex).]]. + self assert: CABlocks stone equals: (grid cellAtRow: rowIndex andCol: colIndex).]]. CAGrid clear: grid. ] { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:57' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testFillTNT [ @@ -127,13 +127,13 @@ CAGridTest >> testFillTNT [ do: [:rowIndex | 1 to: numCols do: [:colIndex | - self assert: CABlocks tnt equals: (grid getCellAtRow: rowIndex andCol: colIndex).]]. + self assert: CABlocks tnt equals: (grid cellAtRow: rowIndex andCol: colIndex).]]. CAGrid clear: grid. ] { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:57' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testGetNeighbors [ @@ -141,14 +141,14 @@ CAGridTest >> testGetNeighbors [ numCols := 3. numRows := 3. CAGrid clear: grid. - neighbors := grid getNeighborsOfCellAtRow: 2 andCol: 2. + neighbors := grid neighborsOfCellAtRow: 2 andCol: 2. 1 to: numRows do: [:rowIndex | 1 to: numCols do: [:colIndex | self assert: CABlocks air equals: (neighbors at: rowIndex at: colIndex).]]. grid putCell: 1 atRow: 2 andCol: 2. - neighbors := grid getNeighborsOfCellAtRow: 2 andCol: 2. + neighbors := grid neighborsOfCellAtRow: 2 andCol: 2. self assert: 1 equals: (neighbors at: 2 at: 2). CAGrid clear: grid. ] @@ -186,11 +186,11 @@ CAGridTest >> testNumRows [ { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:48' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CAGridTest >> testPutCellGetCell [ grid putCell: 1 atRow: 1 andCol: 1. - self assert: 1 equals: (grid getCellAtRow: 1 andCol: 1). + self assert: 1 equals: (grid cellAtRow: 1 andCol: 1). CAGrid clear: grid. ] diff --git a/src/ComputationalArtTests/CARulesTest.class.st b/src/ComputationalArtTests/CARulesTest.class.st index 6e8f371..60495be 100644 --- a/src/ComputationalArtTests/CARulesTest.class.st +++ b/src/ComputationalArtTests/CARulesTest.class.st @@ -33,7 +33,7 @@ CARulesTest >> tearDown [ { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 20:00' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRuleFallDown [ @@ -56,28 +56,28 @@ CARulesTest >> testRuleFallDown [ andCol: 40. ruler applyRules: ruleSet to: grid. self - assert: (grid getCellAtRow: 10 andCol: 10) + assert: (grid cellAtRow: 10 andCol: 10) equals: CABlocks air. self - assert: (grid getCellAtRow: 10 andCol: 20) + assert: (grid cellAtRow: 10 andCol: 20) equals: CABlocks air. self - assert: (grid getCellAtRow: 10 andCol: 30) + assert: (grid cellAtRow: 10 andCol: 30) equals: CABlocks air. self - assert: (grid getCellAtRow: 10 andCol: 40) + assert: (grid cellAtRow: 10 andCol: 40) equals: CABlocks air. self - assert: (grid getCellAtRow: 11 andCol: 10) + assert: (grid cellAtRow: 11 andCol: 10) equals: CABlocks water. self - assert: (grid getCellAtRow: 11 andCol: 20) + assert: (grid cellAtRow: 11 andCol: 20) equals: CABlocks algae. self - assert: (grid getCellAtRow: 11 andCol: 30) + assert: (grid cellAtRow: 11 andCol: 30) equals: CABlocks fire. self - assert: (grid getCellAtRow: 11 andCol: 40) + assert: (grid cellAtRow: 11 andCol: 40) equals: CABlocks fish. ruleSet removeAll. CAGrid clear: grid. @@ -85,7 +85,7 @@ CARulesTest >> testRuleFallDown [ { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 19:59' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRuleRise [ @@ -96,10 +96,10 @@ CARulesTest >> testRuleRise [ andCol: 10. ruler applyRules: ruleSet to: grid. self - assert: (grid getCellAtRow: 10 andCol: 10) + assert: (grid cellAtRow: 10 andCol: 10) equals: CABlocks air. self - assert: (grid getCellAtRow: 9 andCol: 10) + assert: (grid cellAtRow: 9 andCol: 10) equals: CABlocks smoke. ruleSet removeAll. CAGrid clear: grid. @@ -107,7 +107,7 @@ CARulesTest >> testRuleRise [ { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 23:34' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRuleSink [ @@ -130,16 +130,16 @@ CARulesTest >> testRuleSink [ andCol: 20. ruler applyRules: ruleSet to: grid. self - assert: (grid getCellAtRow: 10 andCol: 10) + assert: (grid cellAtRow: 10 andCol: 10) equals: CABlocks fire. self - assert: (grid getCellAtRow: 10 andCol: 20) + assert: (grid cellAtRow: 10 andCol: 20) equals: CABlocks water. self - assert: (grid getCellAtRow: 11 andCol: 10) + assert: (grid cellAtRow: 11 andCol: 10) equals: CABlocks sand. self - assert: (grid getCellAtRow: 11 andCol: 20) + assert: (grid cellAtRow: 11 andCol: 20) equals: CABlocks sand. ruleSet removeAll. CAGrid clear: grid. @@ -147,7 +147,7 @@ CARulesTest >> testRuleSink [ { #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 7/12/2024 21:24' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRulesAlgae [ | algaeCount waterCount airCount | @@ -187,13 +187,13 @@ CARulesTest >> testRulesAlgae [ do: [:rowIndex | 1 to: 100 do: [:colIndex | - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks air ifTrue: [airCount := airCount + 1]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks water ifTrue: [waterCount := waterCount + 1]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks algae ifTrue: [algaeCount := algaeCount + 1]]]. self assert: waterCount + algaeCount equals: 6. @@ -204,7 +204,7 @@ CARulesTest >> testRulesAlgae [ { #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 7/12/2024 21:23' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRulesFish [ | fishCount waterCount airCount | @@ -258,13 +258,13 @@ CARulesTest >> testRulesFish [ do: [:rowIndex | 1 to: 100 do: [:colIndex | - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks air ifTrue: [airCount := airCount + 1]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks water ifTrue: [waterCount := waterCount + 1]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks fish ifTrue: [fishCount := fishCount + 1]]]. self assert: waterCount equals: 8. @@ -276,7 +276,7 @@ CARulesTest >> testRulesFish [ { #category : #testing, - #'squeak_changestamp' : 'KoPa 7/12/2024 20:01' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRulesFluids [ @@ -304,10 +304,10 @@ CARulesTest >> testRulesFluids [ do: [:rowIndex | 1 to: 100 do: [:colIndex | - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks air ifTrue: [airCount := airCount + 1.]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks water ifTrue: [waterCount := waterCount + 1.]]]. self assert: waterCount equals: 3. @@ -317,7 +317,7 @@ CARulesTest >> testRulesFluids [ { #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 7/12/2024 21:40' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRulesLife [ | airCount stoneCount | @@ -351,26 +351,26 @@ CARulesTest >> testRulesLife [ do: [:rowIndex | 1 to: 100 do: [:colIndex | - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks air ifTrue: [airCount := airCount + 1]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks stone ifTrue: [stoneCount := stoneCount + 1]]]. self - assert: (grid getCellAtRow: 20 andCol: 20) + assert: (grid cellAtRow: 20 andCol: 20) equals: CABlocks stone. self - assert: (grid getCellAtRow: 20 andCol: 21) + assert: (grid cellAtRow: 20 andCol: 21) equals: CABlocks stone. self - assert: (grid getCellAtRow: 20 andCol: 22) + assert: (grid cellAtRow: 20 andCol: 22) equals: CABlocks stone. self - assert: (grid getCellAtRow: 19 andCol: 22) + assert: (grid cellAtRow: 19 andCol: 22) equals: CABlocks stone. self - assert: (grid getCellAtRow: 18 andCol: 21) + assert: (grid cellAtRow: 18 andCol: 21) equals: CABlocks stone. self assert: stoneCount equals: 5. self assert: airCount equals: 10000 - 5. @@ -380,7 +380,7 @@ CARulesTest >> testRulesLife [ { #category : #'as yet unclassified', - #'squeak_changestamp' : 'Sars 7/12/2024 21:25' + #'squeak_changestamp' : 'KoPa 7/12/2024 23:49' } CARulesTest >> testRulesSand [ | airCount sandCount | @@ -408,10 +408,10 @@ CARulesTest >> testRulesSand [ do: [:rowIndex | 1 to: 100 do: [:colIndex | - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks air ifTrue: [airCount := airCount + 1]. - (grid getCellAtRow: rowIndex andCol: colIndex) + (grid cellAtRow: rowIndex andCol: colIndex) = CABlocks sand ifTrue: [sandCount := sandCount + 1]]]. self assert: sandCount equals: 3.