Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9581e69
Fix horizontal compact region wiring between adjacent junctions.
ViezeVingertjes Jun 18, 2026
db1a562
Fix addPAt test helper placing N silicon instead of P.
ViezeVingertjes Jun 18, 2026
e2c572f
Fix ChDGeneratorRegion currentState returning random values.
ViezeVingertjes Jun 18, 2026
56b302b
Replace removed Array2D with ChDCellGrid for Pharo 13.
ViezeVingertjes Jun 18, 2026
ea9ffce
Migrate ChDDialog to SpRequestDialog for Pharo 13 export/import.
ViezeVingertjes Jun 18, 2026
a395ebd
Use Spec2 popover API for the selection context menu.
ViezeVingertjes Jun 18, 2026
fc23dbc
Add ChDResources helper for graphics and levels asset paths.
ViezeVingertjes Jun 18, 2026
099840b
Document Pharo 13 requirement and resource root setup.
ViezeVingertjes Jun 18, 2026
5c8a91d
Add headless test runner and Pharo 13 CI workflow.
ViezeVingertjes Jun 18, 2026
af1abab
Merge fix/junction-and-test-helper-bugs into Pharo 13 branch.
ViezeVingertjes Jun 18, 2026
e1b2bb2
Fix Pharo 13 CI workflow to use pharo-setup-gha.
ViezeVingertjes Jun 18, 2026
0aa9aa5
Make run-tests scripts portable via environment variables.
ViezeVingertjes Jun 18, 2026
1a5d794
Replace ChDDialog title sniffing with isExport flag.
ViezeVingertjes Jun 18, 2026
574b9d0
Add ChDResources graphics and levels file helpers.
ViezeVingertjes Jun 18, 2026
8ce1cb6
Remove unused ChDTestRunner>>runAllAndReport.
ViezeVingertjes Jun 18, 2026
2200ba0
Consolidate ChDResources environment integration tests.
ViezeVingertjes Jun 18, 2026
183a3e4
Add gitignore and remove dead investigation artifacts.
ViezeVingertjes Jun 18, 2026
fe4a667
Guard ChDCellGrid against zero dimensions.
ViezeVingertjes Jun 18, 2026
d0def69
Signal ChDResourcesNotConfiguredError when repo root is unset
ViezeVingertjes Jun 18, 2026
a70518d
Constrain baseline to Pharo 13.x
ViezeVingertjes Jun 18, 2026
61ae761
Move ChDTestRunner to ChipDesigner-Tools package
ViezeVingertjes Jun 18, 2026
012a3d7
Add Pharo 14 forward compatibility while targeting Pharo 13 stable.
ViezeVingertjes Jun 18, 2026
a2e712f
Update README for load groups and headless test setup.
ViezeVingertjes Jun 18, 2026
38b2c7e
Fix Pharo 13 Announcer and ChDCellGrid iteration APIs.
ViezeVingertjes Jun 18, 2026
b6c0a09
Improve asset path resolution and simplify load instructions.
ViezeVingertjes Jun 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pharo13-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pharo 13 tests

on:
push:
branches: [ master, 'feature/**' ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Pharo 13
uses: demarey/pharo-setup-gha@main
with:
version: 13

- name: Run ChipDesigner tests
env:
PHARO_CHIPDESIGNER_ROOT: ${{ github.workspace }}
run: ./tools/run-tests.sh
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PharoDebug.log
*.changes
*.sources
package-cache/
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ It is an inaccurate and highly simplified tool for the design of silicon chip la

## How to load

The Pharo Chip Designer runs withing Pharo 10.0 environment. Currently, it is not provided as a standalone application because the main purpose of it is not to imitate the original game but to provide a base for own experiments where you want to have full control over the input and output signals. Pharo provides an interactive environment for it. So you first should install Pharo Launcher, then prepare a Pharo 10.0 image and load the Chip Designer into it.
The Pharo Chip Designer requires **Pharo 13.0** or newer.

1) Install Pharo Launcher from http://pharo.org/download)
2) Create a new image from the template named "Pharo 10.0 - 64bit (stable)" (32bit can be used too)
3) Run the image, open Playground (Tools - Playground), place the following code there, select it and from the context menu choose "Do it"
1. Install [Pharo Launcher](https://pharo.org/download) and create an image from **Pharo 13.0 - 64bit (stable)**.
2. Clone this repository. The `graphics` and `levels` folders must stay at the top level of the clone, next to `src`.
3. Open a Playground (**Tools → Playground**).
4. Run this once. Replace the path with the location of your clone:

```smalltalk
ChDResources repositoryRoot: '/path/to/PharoChipDesigner' asFileReference.
```

5. Run this to load the game:

```smalltalk
Metacello new
Expand All @@ -20,9 +27,27 @@ Metacello new
load.
```

In the Pharo welcome window, you can select the prefered theme (light or dark).
6. Open the game from the menu bar: **Library → Pharo Chip Designer**.

**Optional:** set the environment variable `PHARO_CHIPDESIGNER_ROOT` to your clone path before starting Pharo. Then step 4 is not needed.

This loads the `default` group (`ChipDesigner` only). For headless CI or local test runs, use `load: 'tests'` instead (loads `ChipDesigner-Tools`, which depends on `ChipDesigner`).

In the Pharo welcome window, you can select the preferred theme (light or dark).

## Headless tests

From a cloned repository with Pharo 13 installed, set `PHARO_VM` and `PHARO_IMAGE` to your local VM and image, then:

```bash
export PHARO_VM=/path/to/pharo-vm
export PHARO_IMAGE="/path/to/Pharo 13.image"
./tools/run-tests.sh
```

`PHARO_CHIPDESIGNER_ROOT` defaults to the repository root. On GitHub Actions, `PHARO` is set by [pharo-setup-gha](https://github.com/pharo-project/pharo-setup-gha) and the workflow sets `PHARO_CHIPDESIGNER_ROOT` to the workspace.

To run the game, go to top menu bar - _Library - Pharo Chip Designer_
`./tools/smoke-open.sh` runs the same startup checks without opening a window (same environment variables).

## Controls

Expand Down
10 changes: 7 additions & 3 deletions src/BaselineOfChipDesigner/BaselineOfChipDesigner.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ Class {
{ #category : #baselines }
BaselineOfChipDesigner >> baseline: spec [
<baseline>
"Targets Pharo 13 stable. pharo14.x is included for forward compatibility."

spec for: #common do: [
spec
package: 'ChipDesigner' ]
spec for: #(#'pharo13.x' #'pharo14.x') do: [
spec package: 'ChipDesigner'.
spec package: 'ChipDesigner-Tools' with: [
spec requires: #('ChipDesigner') ].
spec group: 'default' with: #('ChipDesigner').
spec group: 'tests' with: #('ChipDesigner-Tools') ]
]
19 changes: 19 additions & 0 deletions src/ChipDesigner-Tools/ChDTestRunner.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : #ChDTestRunner,
#superclass : #Object,
#category : #ChipDesigner-Tools
}

{ #category : #running }
ChDTestRunner class >> runAll [

| testClasses suite result |
testClasses := OrderedCollection new.
Smalltalk allClassesDo: [ :each |
(each category = 'ChipDesigner-Tests' and: [ each inheritsFrom: TestCase ])
ifTrue: [ testClasses add: each ] ].
suite := TestSuite named: 'ChipDesigner-Tests'.
testClasses do: [ :each | each addToSuiteFromSelectors: suite ].
result := suite run.
^ result
]
1 change: 1 addition & 0 deletions src/ChipDesigner-Tools/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #ChipDesigner-Tools }
12 changes: 6 additions & 6 deletions src/ChipDesigner/ChDArea.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"
I store information about the silicon chip area of given dimension (width, height).

I have an Array2D of cells (array).
I have a ChDCellGrid of cells (array).

I have two layers - substrate and metal. The layers are ""strategies"" that define the behavior of cells.

Expand Down Expand Up @@ -104,7 +104,7 @@ ChDArea >> addPAt: x y: y addConnections: connectionsInteger [
| aCell |

aCell := self atX: x y: y.
self substrateLayer setFor: aCell mode: #n.
self substrateLayer setFor: aCell mode: #p.
self substrateLayer connectionsFor: aCell add: connectionsInteger.
^ aCell

Expand All @@ -113,7 +113,7 @@ ChDArea >> addPAt: x y: y addConnections: connectionsInteger [
{ #category : #'cell access' }
ChDArea >> allSubstrateCells [

^ array privateContents select: [ :each | each hasSubstrate or: [ each hasJunction ] ]
^ array flatContents select: [ :each | each hasSubstrate or: [ each hasJunction ] ]
]

{ #category : #'tests support' }
Expand Down Expand Up @@ -204,7 +204,7 @@ ChDArea >> decodeFrom: aString [
ifTrue: [
arrayIndex := arrayIndex + ((int bitShiftMagnitude: -1) - 1) ]
ifFalse: [
(array privateContents at: arrayIndex) decodeFrom: s ].
(array flatContents at: arrayIndex) decodeFrom: s ].
arrayIndex := arrayIndex + 1 ].

self recreateMetalRegions.
Expand Down Expand Up @@ -411,7 +411,7 @@ ChDArea >> initializeForExtent: aPoint [
width := aPoint x.
height := aPoint y.

array := Array2D rows: self height columns: self width.
array := ChDCellGrid rows: self height columns: self width.
1 to: self height do: [ :y |
1 to: self width do: [ :x |
array at: y at: x put: (ChDCell new x:x; y:y; yourself)] ].
Expand Down Expand Up @@ -517,7 +517,7 @@ ChDArea >> mergeSubstrateRegions: regionsToMerge [
{ #category : #'cell access' }
ChDArea >> metalCells [

^ array privateContents select: [ :each | each hasMetal ]
^ array flatContents select: [ :each | each hasMetal ]
]

{ #category : #accessing }
Expand Down
2 changes: 1 addition & 1 deletion src/ChipDesigner/ChDAreaDisplay.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ ChDAreaDisplay >> resetExtent [
ChDAreaDisplay >> subscribe [

area announcer when: ChDDirtyCellsAnnouncement do: [ :announcement |
self dirtyCells: announcement cells ]
self dirtyCells: announcement cells ] for: self
]

{ #category : #accessing }
Expand Down
19 changes: 19 additions & 0 deletions src/ChipDesigner/ChDAreaInputRegionsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,22 @@ ChDAreaInputRegionsTest >> testNotConnectedCell [

self assert: area regions size equals: 2.
]

{ #category : #tests }
ChDAreaInputRegionsTest >> testInputRegionCurrentStateReflectsStoredValue [

| region states |

region := (area atX: 1 y: 1) metalRegion.
self assert: region class name equals: 'ChDGeneratorRegion'.

states := (1 to: 20) collect: [ :i |
region currentState: true.
region currentState ].
self assert: (states allSatisfy: [ :value | value == true ]).

states := (1 to: 20) collect: [ :i |
region currentState: false.
region currentState ].
self assert: (states allSatisfy: [ :value | value == false ])
]
20 changes: 20 additions & 0 deletions src/ChipDesigner/ChDAreaTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ ChDAreaTest >> setUp [
area := ChDArea withDefaultExtent
]

{ #category : #tests }
ChDAreaTest >> testDecodeFromNotGate [

area := ChDArea decodeFrom:
'0000200003200C162109240250B00B0000262003'.
self assert: area width equals: 2.
self assert: area height equals: 3.
self assert: (area atX: 2 y: 3) hasMetal
]

{ #category : #tests }
ChDAreaTest >> testAddNewStandaloneRegion [
| aCell |
Expand All @@ -38,6 +48,16 @@ ChDAreaTest >> testAddNewStandaloneSubstrateRegion [
self assertCollection: area regions anyOne cells hasSameElements: {aCell}
]

{ #category : #tests }
ChDAreaTest >> testAddPAtSetsPSilicon [
| aCell |

aCell := area addPAt: 5 y: 5 addConnections: 2r0000.
area updateCell: aCell mode: #p.

self assert: aCell substrateType equals: #p
]

{ #category : #tests }
ChDAreaTest >> testMergeRegions [
| cell1 cell2 |
Expand Down
63 changes: 63 additions & 0 deletions src/ChipDesigner/ChDCellGrid.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Class {
#name : #ChDCellGrid,
#superclass : #Object,
#instVars : [
'rows',
'contents'
],
#category : #ChipDesigner
}

{ #category : #'instance creation' }
ChDCellGrid class >> rows: rowCount columns: columnCount [

^ self new
initializeRows: rowCount columns: columnCount;
yourself
]

{ #category : #accessing }
ChDCellGrid >> at: rowIndex at: columnIndex [

^ (contents at: rowIndex) at: columnIndex
]

{ #category : #accessing }
ChDCellGrid >> at: rowIndex at: columnIndex put: anObject [

^ (contents at: rowIndex) at: columnIndex put: anObject
]

{ #category : #accessing }
ChDCellGrid >> columnCount [

^ contents first size
]

{ #category : #enumerating }
ChDCellGrid >> do: aBlock [

^ self flatContents do: aBlock
]

{ #category : #accessing }
ChDCellGrid >> flatContents [

^ contents flattened
]

{ #category : #accessing }
ChDCellGrid >> rowCount [

^ rows
]

{ #category : #initialization }
ChDCellGrid >> initializeRows: rowCount columns: columnCount [

rowCount < 1 | (columnCount < 1) ifTrue: [
self error: 'ChDCellGrid requires positive row and column counts' ].
rows := rowCount.
contents := (1 to: rowCount) collect: [ :each |
Array new: columnCount ]
]
58 changes: 58 additions & 0 deletions src/ChipDesigner/ChDCellGridTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Class {
#name : #ChDCellGridTest,
#superclass : #TestCase,
#category : #'ChipDesigner-Tests'
}

{ #category : #tests }
ChDCellGridTest >> testAtAtPutAndRead [

| grid |
grid := ChDCellGrid rows: 3 columns: 4.
grid at: 2 at: 3 put: #cell23.
self assert: (grid at: 2 at: 3) identicalTo: #cell23
]

{ #category : #tests }
ChDCellGridTest >> testDimensions [

| grid |
grid := ChDCellGrid rows: 5 columns: 7.
self assert: grid rowCount equals: 5.
self assert: grid columnCount equals: 7
]

{ #category : #tests }
ChDCellGridTest >> testFlatContentsIsRowMajor [

| grid |
grid := ChDCellGrid rows: 2 columns: 3.
1 to: 2 do: [ :row |
1 to: 3 do: [ :col |
grid at: row at: col put: row * 10 + col ] ].
self assert: grid flatContents equals: #(11 12 13 21 22 23)
]

{ #category : #tests }
ChDCellGridTest >> testZeroRowsSignalsError [

self should: [ ChDCellGrid rows: 0 columns: 3 ] raise: Error
]

{ #category : #tests }
ChDCellGridTest >> testDoIteratesFlatContents [

| grid visited |
grid := ChDCellGrid rows: 2 columns: 2.
visited := OrderedCollection new.
grid do: [ :each | visited add: each ].
self assert: visited size equals: 4
]

{ #category : #tests }
ChDCellGridTest >> testFlatContentsSize [

| grid |
grid := ChDCellGrid rows: 4 columns: 6.
self assert: grid flatContents size equals: 24
]
Loading