Skip to content

Commit

Permalink
Merge pull request #65 from hpi-swa-teaching/feat/ls/neg-rules-test
Browse files Browse the repository at this point in the history
added new non-deterministic tests
  • Loading branch information
KDPawn authored Jun 24, 2024
2 parents 76d5ef9 + 02446fc commit 0309159
Show file tree
Hide file tree
Showing 22 changed files with 189 additions and 110 deletions.
42 changes: 21 additions & 21 deletions src/ComputationalArt/CAGame.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ CAGame >> skipAhead: stepCount [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/23/2024 16:40'
#'squeak_changestamp' : 'Sars 6/24/2024 10:53'
}
CAGame >> start [
| maxIterations iterationCount gameloop ui |
Expand All @@ -109,26 +109,26 @@ CAGame >> start [
brushSize := 1.
ruler := CARuler new.
activeCellType := CABlocks tnt.
ruleSet := OrderedCollection new add: CARuleFallDownEX new;
add: CARuleSinkEX new;
add: CARuleFluidFlowLeftEX new;
add: CARuleFluidFlowRightEX new;
add: CARulePyramidLeftEX new;
add: CARulePyramidRightEX new;
add: CARuleAlgaeDieEX new;
add: CARuleAlgaeGrowEX new;
add: CARuleRiseEX new;
add: CARuleGasFlowLeftEX new;
add: CARuleGasFlowRightEX new;
add: CARuleGasDisappearEX new;
add: CARuleFireOutEX new;
add: CARuleBurnEX new;
add: CARuleFishSwimLeftEX new;
add: CARuleFishSwimRightEX new;
add: CARuleFishSwimUpEX new;
add: CARuleFishSwimDownEX new;
add: CARuleFishDieEX new;
add: CARuleTntSpreadEX new;
ruleSet := OrderedCollection new add: CARuleFallDown new;
add: CARuleSink new;
add: CARuleFluidFlowLeft new;
add: CARuleFluidFlowRight new;
add: CARulePyramidLeft new;
add: CARulePyramidRight new;
add: CARuleAlgaeDie new;
add: CARuleAlgaeGrow new;
add: CARuleRise new;
add: CARuleGasFlowLeft new;
add: CARuleGasFlowRight new;
add: CARuleGasDisappear new;
add: CARuleFireOut new;
add: CARuleBurn new;
add: CARuleFishSwimLeft new;
add: CARuleFishSwimRight new;
add: CARuleFishSwimUp new;
add: CARuleFishSwimDown new;
add: CARuleFishDie new;
add: CARuleTntSpread new;
yourself.
grid := CAGrid new.
CAGrid fill: grid.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleAlgaeDieEX,
#name : #CARuleAlgaeDie,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 13:32'
}
CARuleAlgaeDieEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleAlgaeDie >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
|me waterCount chance tempCell|

me := neighborMatrix at: 2 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleAlgaeGrowEX,
#name : #CARuleAlgaeGrow,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 13:31'
}
CARuleAlgaeGrowEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleAlgaeGrow >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
|me algaeCount chance tempCell|

me := neighborMatrix at: 2 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleBurnEX,
#name : #CARuleBurn,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 22:08'
}
CARuleBurnEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleBurn >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me fireCount chance tempCell |
me := neighborMatrix at: 2 at: 2.
chance := (1 to: 100) atRandom.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFallDownEX,
#name : #CARuleFallDown,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'HaMa 6/14/2024 11:44'
}
CARuleFallDownEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFallDown >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| aboveMe me belowMe fallingBlocks fallingThroughBlocks |
aboveMe := neighborMatrix at: 1 at: 2.
me := neighborMatrix at: 2 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFireOutEX,
#name : #CARuleFireOut,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 22:04'
}
CARuleFireOutEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFireOut >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me waterCount woodCount chance tempCell |
me := neighborMatrix at: 2 at: 2.
chance := (1 to: 100) atRandom.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFishDieEX,
#name : #CARuleFishDie,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'HaMa 6/14/2024 11:54'
}
CARuleFishDieEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFishDie >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me belowMe aboveMe rightMe leftMe futureAboveMe swimmingBlocks swimThroughBlocks chance |
me := neighborMatrix at: 2 at: 2.
belowMe := neighborMatrix at: 3 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFishSwimDownEX,
#name : #CARuleFishSwimDown,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'HaMa 6/14/2024 12:12'
}
CARuleFishSwimDownEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFishSwimDown >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me belowMe aboveMe futureAboveMe swimmingBlocks swimThroughBlocks eatBlocks chance |
me := neighborMatrix at: 2 at: 2.
belowMe := neighborMatrix at: 3 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFishSwimLeftEX,
#name : #CARuleFishSwimLeft,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'HaMa 6/14/2024 12:14'
}
CARuleFishSwimLeftEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFishSwimLeft >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe leftMe futureLeftMe swimmingBlocks swimThroughBlocks eatBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFishSwimRightEX,
#name : #CARuleFishSwimRight,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'HaMa 6/14/2024 12:15'
}
CARuleFishSwimRightEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFishSwimRight >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe leftMe futureLeftMe swimmingBlocks swimThroughBlocks eatBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFishSwimUpEX,
#name : #CARuleFishSwimUp,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'HaMa 6/14/2024 12:16'
}
CARuleFishSwimUpEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFishSwimUp >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me belowMe aboveMe futureAboveMe swimmingBlocks swimThroughBlocks eatBlocks chance |
me := neighborMatrix at: 2 at: 2.
belowMe := neighborMatrix at: 3 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFluidFlowLeftEX,
#name : #CARuleFluidFlowLeft,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 22:02'
}
CARuleFluidFlowLeftEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFluidFlowLeft >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe belowRightMe leftMe futureLeftMe solidBlocks flowingBlocks flowThroughBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleFluidFlowRightEX,
#name : #CARuleFluidFlowRight,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 22:02'
}
CARuleFluidFlowRightEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleFluidFlowRight >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe belowMe leftMe futureLeftMe solidBlocks flowingBlocks flowThroughBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleGasDisappearEX,
#name : #CARuleGasDisappear,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 21:33'
}
CARuleGasDisappearEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleGasDisappear >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me gasBlocks chance |
me := neighborMatrix at: 2 at: 2.
chance := (1 to: 100) atRandom.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleGasFlowLeftEX,
#name : #CARuleGasFlowLeft,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 21:17'
}
CARuleGasFlowLeftEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleGasFlowLeft >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe belowRightMe leftMe futureLeftMe flowingBlocks flowThroughBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleGasFlowRightEX,
#name : #CARuleGasFlowRight,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/12/2024 21:23'
}
CARuleGasFlowRightEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleGasFlowRight >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe belowMe leftMe futureLeftMe flowingBlocks flowThroughBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARulePyramidLeftEX,
#name : #CARulePyramidLeft,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/16/2024 20:54'
}
CARulePyramidLeftEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARulePyramidLeft >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe belowMe leftMe belowLeftMe futureLeftMe aboveRightMe futureAboveRightMe pyramidBlocks lightBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARulePyramidRightEX,
#name : #CARulePyramidRight,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/16/2024 20:54'
}
CARulePyramidRightEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARulePyramidRight >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me rightMe belowMe leftMe belowRightMe futureLeftMe aboveLeftMe futureAboveLeftMe pyramidBlocks lightBlocks chance |
me := neighborMatrix at: 2 at: 2.
rightMe := neighborMatrix at: 2 at: 3.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleRiseEX,
#name : #CARuleRise,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/16/2024 20:55'
}
CARuleRiseEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleRise >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| aboveMe me belowMe risingBlocks |
aboveMe := neighborMatrix at: 1 at: 2.
me := neighborMatrix at: 2 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleSinkEX,
#name : #CARuleSink,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/16/2024 20:56'
}
CARuleSinkEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleSink >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| aboveMe me belowMe sinkingBlocks sinkThroughBlocks |
aboveMe := neighborMatrix at: 1 at: 2.
me := neighborMatrix at: 2 at: 2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #CARuleTntSpreadEX,
#name : #CARuleTntSpread,
#superclass : #CARule,
#category : #ComputationalArt
}
Expand All @@ -8,7 +8,7 @@ Class {
#category : #'as yet unclassified',
#'squeak_changestamp' : 'Sars 6/14/2024 17:14'
}
CARuleTntSpreadEX >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
CARuleTntSpread >> applyRuleWith: neighborMatrix and: newNeighborMatrix [
| me tntCount chance tempCell poofBlocks |
me := neighborMatrix at: 2 at: 2.
chance := (1 to: 100) atRandom.
Expand Down
Loading

0 comments on commit 0309159

Please sign in to comment.