Ingleham layout project
A small model railway layout for use with the Inglenook Shunting System
For an explanation of the Inglenook shunting puzzle please see this website here -
http://www.wymann.info/ShuntingPuzzles/Inglenook/inglenook-rules.html
http://www.wymann.info/ShuntingPuzzles/Inglenook/inglenook-rules.html
Click on a picture to see full size and use mouse or L/R keyboard arrows to scroll through gallery.
A short video of some train movements
.The code below is used on a small tablet to shuffle the eight wagons and display their final positions.
The code is written for SmallBASIC which is available on the internet as freeware from
https://smallbasic.github.io/
Also the code is relatively simple and should not be difficult to convert into other BASICs or even to be rewritten into another programming language. if prefered.
The code is written for SmallBASIC which is available on the internet as freeware from
https://smallbasic.github.io/
Also the code is relatively simple and should not be difficult to convert into other BASICs or even to be rewritten into another programming language. if prefered.
CODE
rem INGLENOOK GOODS WAGON SHUNTING PROGRAM
rem programmed in SmallBASIC - https://smallbasic.github.io/
rem Created: Alan Steelbat 01/01/2023 , Last Modified 17/01/2024
w=window()
w.setFont(1,"em",1,0)
randomise = rnd
let a=0
let r=0
dim Train(8)
dim Wagon$(8)
rem ==== read wagon data into array Wagon$() =======
for i=1 to 8
read Wagon$(i)
next i
rem =============== Start of MAIN LOOP ==============
label RESTART
CLS
delay 300
for i= 1 to 8
Train(i)=0
next i
rem ====== put random wagons into array Train() ======
for i = 1 to 8
Repeat
a=0
r = int(rnd*8)+1
for j = 1 to 8
if Train(j)=r then a=1
next j
Until a<>1
Train(i)=r
next i
rem ============= Display Output =================
w.setFont(1.2,"em",1,0)
color rgb(0,250,130) : rem green
print " GOODS WAGON SHUNTING PROGRAM"
print " Departure Siding"
for i = 1 to 5
print tab(10) ; Wagon$(Train(i))
next i
print " Goods Shed"
for i = 6 to 8
print tab(10) ; Wagon$(Train(i))
next i
for i = 1 to 5
next i
w.setFont(0.8,"em",1,0)
input "Enter 'n' to EXIT or press Return to go again" ; Q$
if LEFT(Q$,1) = "n" then EXIT
goto RESTART
rem =========== Wagon Data Statements ==============
data "Mineral coal wagon"
data "LOCO coal wagon"
data "Grey box van"
data "Brown box van"
data "Meat/Fish Fridge van"
data "low sided steel open"
data "7 plank open wagon"
data "Oil tank wagon"
rem ---------END OF PROGRAM STATEMENTS -----------