JanetRossini.github.io

Lua, LSL, Blender, Python in Second Life


Project maintained by JanetRossini

Inglenook Shunting Game

May 5, 2025 • [designluashunting]


I’ve become interested in railroad shunting, in particular the Inglenook Shunting game. Could we have something like that for Valkyrie Transport?

Introduction

Here is a game that may tell you everything you need to know about this topic: Beaver Games - Inglenook Shunting.

In the standard “Inglenook” form, we have a small railroad shunting yard, with a lead track that can hold the locomotive and up to three cars. There are three shunts, one that can hold up to five cars, and two that can hold up to three cars.

There is a locomotive and eight cars, five numbered one through five and five blank. The game starts with a random ordering of the cars in the top two shunts.

The locomotive can push and pull the cars. Locomotive and cars couple up when they bump each other. There are three uncoupling points, one at the outer edge of each shunt. These can be used to “cut the line”, so as to pull some of the cars out of the shunt but not all of them.

Our mission is to sort the cars to produce a train consisting of the five numbered cars in increasing numeric order, starting at the loco, 1, 2, 3, 4, 5.

Things We Might Script

Things We Don’t Know

As to doing it in Second Life, with our existing VT code, questions include:

Major Design Issues

If we were just implementing a human-controlled system, it would suffice to provide robust uncoupling and recoupling. We already have forward and backward operation, and switches, or as they are called outside the US, “points”. I am pretty sure that decent coupling capability is all that would be needed.

However, I am quite interested in an automated player that can control the shunting in at least as complicated a situation as standard Inglenook. That complicates things, because that player needs global information about the state of all the cars and shunts. That information is quite abstract compared to the details of the coordinates and rotations of all the cars and loco, which is what a train actually knows now.

So, just now today, I am interested in what kind of data structures and operations would be useful for representing the state of the “game” and for specifying operations that need to take place.

Player Thinking

I’ve played the online game a bunch, and I’m getting kind of good at it, but honestly I don’t yet fully understand my own strategy. Let me try to see what I do …

But there are things I still just wonder about.

Design of a “Solver”

Today I’m mostly interested in how we might represent the Inglenook Siding game in an SLua script, and how we might devise a solver. Somewhere back in my history I actually studied heuristics and maybe I can remember how to put them together to try to solve something. Or invent something. Or find something on the Internet to copy.

We have a locomotive, five numbered cars and five blank cars.

There are four main track segments, a five-car shunt, two three-car shunts, and a “lead” track that has room for the loco and three cars.

The initial setup has five random cars in the top shunt and three random cars in the middle one, nothing in the third, and the loco down in the lead track.

Possibly we can ignore the locomotive by treating the lead track as being of length three. Probably not, because the locomotive does constrain what units can be moved and where they can be moved to.

There are the two switches, which amount to Y-connections with only one path open. They are long enough to hold the loco or car, actually a bit longer than a single unit length, at least in the game we’re looking at. A switch will not operate if any part of a car or loco is in it.

Will it suffice, for an internal model of the game, to treat all these locations as fixed elements, with each car or loco always in one and only one location? Can we ignore the overlapping situation and just consider what amounts to the center of each loco or car? My intuition says that we can, for modeling purposes.

Summary

This morning I only have questions and vague notions. My plan for the next phase is to draw some pictures that show what segments are connected and then imagine moves that can and cannot be made. I am vaguely thinking that a “move” consists of starting with one connection picture, picking up one or more cars, drawing them into the lead, then changing the connections and putting one or more of those cars somewhere else. I’m not sure how we’ll decide which moves are making progress and which are not. One needs a measure of desirability for an arrangement, some kind of metric of “value” or “goodness”.

If there was a measure like that and if we could compare any two adjacent configurations and decide which one was better, a simple hill-climbing algorithm would suffice. I am almost certain that no such thing exists, because if it did, there would be a writeup somewhere. Instead there are even recent contests with real money payouts for solutions to the problem.

I’m not in it for the money, but for the fun. So far so good.

Safe paths!