Skip to content

Commit

Permalink
Merge branch 'main' into code-execution
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlDuda committed Jun 23, 2024
2 parents 9dc8c63 + ef1cd69 commit 5de739d
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 125 deletions.
65 changes: 39 additions & 26 deletions .squot-materialize
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
[
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Cloverleaf.png'
],
#encoding : Class [ #PNGReadWriter ]
},
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'play.png'
],
#encoding : @4
},
SquotTonelMapper {
#package : MCPackage {
#name : 'SqueakKara'
#name : 'SqueakKara-Tests'
},
#path : FSAbsolutePath [
'src'
Expand All @@ -10,63 +24,62 @@
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Cloverleaf.png'
'stop.png'
],
#encoding : Class [ #PNGReadWriter ]
#encoding : @4
},
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Kara-FacingLeft.png'
'Kara-FacingUp.png'
],
#encoding : @7
#encoding : @4
},
SquotTonelMapper {
#package : MCPackage {
#name : 'SqueakKara-Core'
},
#path : @9
},
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Kara-FacingDown.png'
'pause.png'
],
#encoding : @7
#encoding : @4
},
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Kara-FacingRight.png'
'Trunk.png'
],
#encoding : @7
#encoding : @4
},
SquotTonelMapper {
#package : MCPackage {
#name : 'SqueakKara-Tests'
},
SquotImageMapper {
#path : FSAbsolutePath [
'src'
]
'assets',
'Kara-FacingLeft.png'
],
#encoding : @4
},
SquotTonelMapper {
#package : MCPackage {
#name : 'BaselineOfSqueakKara'
},
#path : @16
#path : @9
},
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Kara-FacingUp.png'
'Kara-FacingRight.png'
],
#encoding : @7
#encoding : @4
},
SquotImageMapper {
#path : FSAbsolutePath [
'assets',
'Trunk.png'
'Kara-FacingDown.png'
],
#encoding : @7
},
SquotTonelMapper {
#package : MCPackage {
#name : 'SqueakKara-Core'
},
#path : @16
#encoding : @4
}
]
Binary file added assets/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 1 addition & 35 deletions src/SqueakKara-Core/SKEnvironment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ SKEnvironment >> initialize [

{
#category : #initialization,
#'squeak_changestamp' : 'KD 6/23/2024 19:35'
#'squeak_changestamp' : 'JJG 6/18/2024 18:47'
}
SKEnvironment >> initializeWithChallenge1 [

Expand All @@ -123,40 +123,6 @@ SKEnvironment >> initializeWithChallenge1 [
self workspace: (SKWorkspace newWithKara: self kara).
self executer: (SKExecuter new).
(self executer kara) kara: self kara.
self executeControls: SKExecuteControls new.
executeControls environment: self.
]

{
#category : #initialization,
#'squeak_changestamp' : 'KD 6/23/2024 19:40'
}
SKEnvironment >> initializeWithChallenge2 [


self grid: (SKGrid newWithExtent: 9 @ 2).
self kara: self grid challenge2.
self workspace: (SKWorkspace newWithKara: self kara).
self executer: (SKExecuter new).
(self executer kara) kara: self kara.
self executeControls: SKExecuteControls new.
executeControls environment: self.
]

{
#category : #initialization,
#'squeak_changestamp' : 'KD 6/23/2024 19:59'
}
SKEnvironment >> initializeWithChallenge3 [


self grid: (SKGrid newWithExtent: 9 @ 3).
self kara: self grid challenge3.
self workspace: (SKWorkspace newWithKara: self kara).
self executer: (SKExecuter new).
(self executer kara) kara: self kara.
self executeControls: SKExecuteControls new.
executeControls environment: self.
]

{
Expand Down
29 changes: 13 additions & 16 deletions src/SqueakKara-Core/SKExecuteControls.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ Class {

{
#category : #widgets,
#'squeak_changestamp' : 'EB 6/22/2024 15:05'
#'squeak_changestamp' : 'EB 6/23/2024 19:42'
}
SKExecuteControls >> actionRun [
|dict label texture|
|dict texture|
dict := Dictionary new.
dict at: #terminated put:[self environment run. label := 'pause'. texture := self pauseTextureFilename].
dict at: #suspended put:[self environment resume. label := 'pause'. texture := self pauseTextureFilename].
dict at: #running put:[self environment pause. label := 'resume'. texture := self runTextureFilename].
dict at: #terminated put:[self environment run. texture := self pauseTextureFilename].
dict at: #suspended put:[self environment resume. texture := self pauseTextureFilename].
dict at: #running put:[self environment pause. texture := self runTextureFilename].
(dict at: self environment executerState) value.
self buttonRun label: label.
self buttonRunSetTexture: texture.
]

Expand Down Expand Up @@ -70,25 +69,23 @@ SKExecuteControls >> addWidgetCentered: aWidget atXPosition: aXValue [

{
#category : #widgets,
#'squeak_changestamp' : 'EB 6/22/2024 15:00'
#'squeak_changestamp' : 'EB 6/23/2024 19:41'
}
SKExecuteControls >> buildButtonRun [

^IconicButton new
label: 'run';
target: self;
actionSelector: #actionRun;
color: Color lightGray.
]

{
#category : #widgets,
#'squeak_changestamp' : 'EB 6/22/2024 15:00'
#'squeak_changestamp' : 'EB 6/23/2024 19:42'
}
SKExecuteControls >> buildButtonStop [

^ IconicButton new
label: 'stop';
target: self;
actionSelector: #actionStop;
color: Color lightGray
Expand Down Expand Up @@ -218,20 +215,20 @@ SKExecuteControls >> initialize [

{
#category : #texture,
#'squeak_changestamp' : 'KD 6/23/2024 19:51'
#'squeak_changestamp' : 'EB 6/23/2024 19:40'
}
SKExecuteControls >> pauseTextureFilename [

^'Kara-FacingUp.png'
^'pause.png'
]

{
#category : #texture,
#'squeak_changestamp' : 'KD 6/23/2024 19:51'
#'squeak_changestamp' : 'EB 6/23/2024 19:40'
}
SKExecuteControls >> runTextureFilename [

^'Cloverleaf.png'
^'play.png'
]

{
Expand Down Expand Up @@ -262,11 +259,11 @@ SKExecuteControls >> sliderSpeedValueChanged: aValue [

{
#category : #texture,
#'squeak_changestamp' : 'EB 6/22/2024 15:02'
#'squeak_changestamp' : 'EB 6/23/2024 19:40'
}
SKExecuteControls >> stopTextureFilename [

^'Trunk.png'
^'stop.png'
]

{
Expand Down
4 changes: 2 additions & 2 deletions src/SqueakKara-Core/SKExecuter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ SKExecuter >> executeBlock: aBlock [

{
#category : #initialization,
#'squeak_changestamp' : 'EB 6/22/2024 15:07'
#'squeak_changestamp' : 'EB 6/22/2024 14:13'
}
SKExecuter >> initialize [

self kara: SKKaraDecorator new.
self kara executer: self.
self compiler: Compiler new.
self speed: 25.
self speed: 5.
self state: #terminated.
^self
]
Expand Down
45 changes: 3 additions & 42 deletions src/SqueakKara-Core/SKGrid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ SKGrid >> addHorizontalLineAt: aCoordinate [

{
#category : #texture,
#'squeak_changestamp' : 'KD 6/23/2024 19:52'
#'squeak_changestamp' : 'JJG 6/12/2024 16:40'
}
SKGrid >> addTexture [

1 to: self gridHeight - 1 do: [:anInteger |
self addHorizontalLineAt: anInteger].
1 to: self gridWidth - 1 do: [:anInteger |
self addVerticalLineAt: anInteger].
1 to: self gridWidth - 1 do: [:anInteger |
self addHorizontalLineAt: anInteger].
]

{
Expand Down Expand Up @@ -140,45 +140,6 @@ SKGrid >> challenge1 [

]

{
#category : #challenges,
#'squeak_changestamp' : 'KD 6/23/2024 19:54'
}
SKGrid >> challenge2 [

SKTrunk newInGrid: self at: 3 @ 2.
SKTrunk newInGrid: self at: 5 @ 2.
SKTrunk newInGrid: self at: 7 @ 2.

SKCloverleaf newInGrid: self at: 9 @ 2.

^SKKara newInGrid: self at: 1 @ 2.

]

{
#category : #challenges,
#'squeak_changestamp' : 'KD 6/23/2024 19:59'
}
SKGrid >> challenge3 [

SKTrunk newInGrid: self at: 2 @ 1.
SKTrunk newInGrid: self at: 3 @ 1.
SKTrunk newInGrid: self at: 4 @ 1.
SKTrunk newInGrid: self at: 5 @ 1.
SKTrunk newInGrid: self at: 6 @ 1.

SKTrunk newInGrid: self at: 4 @ 3.
SKTrunk newInGrid: self at: 5 @ 3.
SKTrunk newInGrid: self at: 6 @ 3.
SKTrunk newInGrid: self at: 7 @ 3.
SKTrunk newInGrid: self at: 8 @ 3.
SKTrunk newInGrid: self at: 9 @ 3.

^SKKara newInGrid: self at: 1 @ 2.

]

{
#category : #initialization,
#'squeak_changestamp' : 'LK 5/24/2024 11:18'
Expand Down
8 changes: 4 additions & 4 deletions src/SqueakKara-Core/SKLandingPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ SKLandingPage >> actionExample1 [

{
#category : #actions,
#'squeak_changestamp' : 'KD 6/23/2024 19:42'
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
}
SKLandingPage >> actionExample2 [

SKEnvironment basicNew initializeWithChallenge2.
SKEnvironment basicNew initializeWithChallenge1.
self delete
]

{
#category : #actions,
#'squeak_changestamp' : 'KD 6/23/2024 19:42'
#'squeak_changestamp' : 'LK 6/21/2024 23:02'
}
SKLandingPage >> actionExample3 [

SKEnvironment basicNew initializeWithChallenge3.
SKEnvironment basicNew initializeWithChallenge1.
self delete
]

Expand Down

0 comments on commit 5de739d

Please sign in to comment.