Skip to content

Commit

Permalink
Added initEmpty to the mock model
Browse files Browse the repository at this point in the history
  • Loading branch information
olekscode committed Sep 20, 2023
1 parent d159565 commit 4b3111b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
28 changes: 17 additions & 11 deletions repository/Cormas-Mocks/CMMockModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ CMMockModel class >> friendlyName [
^ 'MockModel'
]

{ #category : #'initialize-release' }
{ #category : #init }
CMMockModel >> init [

self
createGridLines: numberOfRows
columns: numberOfColumns
neighbourhood: 8
closed: false.
self initEmpty.

self
createN: initialNumberOfCows
Expand All @@ -76,22 +72,32 @@ CMMockModel >> init [
self
createN: initialNumberOfGoats
randomlyLocatedAloneEntities: CMMockGoat.

self initRandom
]

{ #category : #initialization }
{ #category : #init }
CMMockModel >> initAlive [

self theCells do: #initAlive
]

{ #category : #initialization }
{ #category : #init }
CMMockModel >> initDead [
self theCells do: #initDead
]

{ #category : #initialization }
{ #category : #init }
CMMockModel >> initEmpty [

self
createGridLines: numberOfRows
columns: numberOfColumns
neighbourhood: 8
closed: false.

self initRandom
]

{ #category : #init }
CMMockModel >> initRandom [

self theCells do: #initRandom
Expand Down
2 changes: 1 addition & 1 deletion repository/Cormas-Tests/CMProjectManagerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ CMProjectManagerTest >> testModelControlInitMethods [
CMProjectManagerTest >> testModelInitMethods [

self assert: (self projectManager modelInitMethods isKindOf: Array).
self assert: self projectManager modelInitMethods isEmpty.
self assert: self projectManager modelInitMethods size equals: 5.
]

{ #category : #test }
Expand Down
16 changes: 8 additions & 8 deletions repository/Cormas-UI-Tests/CMR3SpaceTestFixture.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ CMR3SpaceTestFixture >> initialCellStates [
"Initial cell states of a mock model with a fixed random seed"

^ OrderedCollection withAll: #(
dead dead dead dead
dead alive dead dead
dead alive dead alive
dead alive dead dead).
alive alive alive dead
dead dead alive dead
alive dead dead alive
dead dead dead dead).
]

{ #category : #initialization }
Expand Down Expand Up @@ -84,8 +84,8 @@ CMR3SpaceTestFixture >> updatedCellStates [
"Cell states of a mock model with a fixed random seed after one simulation step"

^ OrderedCollection withAll: #(
alive alive alive alive
alive dead alive alive
alive dead alive dead
alive dead alive alive).
dead dead dead alive
alive alive dead alive
dead alive alive dead
alive alive alive alive).
]

0 comments on commit 4b3111b

Please sign in to comment.