May - Jun '19
May '19 Stopped cleaning house and started writing a simulator to implement this "problem." I currently write software primarily in PHP using an Apache local server to interpret the PHP and display the results in a browser. I started using a graphics extension to display the track, signals and trains. This precludes seeing any error messages during development. This requires a second window to troubleshoot and correct my bad typing. I could use an IDE (integrated development environment) for development but I wanted some way to interact with the simulator, so a second window was needed anyway.
Getting PHP to display and update two browser windows results in two processes that refreshes their screen at scheduled intervals. The main process spawns a second process and updated the "state" of the process and reports progress in one window. The spawned process generated the graphics and displays it in a second window. This allows one window to display development information and error message which cannot be displayed on the same window as the graphics. The two processes communicate via data stored in shared session data space.
I had the graphics displayed in a second instance of my browser, so I was able to move that window onto a second monitor attached to my laptop. The second monitor is a not so old TV connected with a HDMI cable.
June '19 Yes I am catching up here. Got the shared process/ two window thing to work nicely. With practice got the text-as-graphics to work above the basic level so I can label things in the image. Another big issue was getting the trains to go around the figure-8 without flipping over and look like they were backing around the curve on the right end of the track.
Developed a 12-step program to go from the 698,880 possible states during the run to the single state in the staging yard with trains in order. It really is a 12-step process. The first phase is to change the path of any trains running around the large oval/figure-8, so they don't run through the staging yard. Turns out it is convenient to change the one or two trains to a CCW figure-8. This also puts them in position to enter the right-hand end of the staging yd. to their final resting place. This takes up the first 9 steps.
The second part is to get the BLACK train running a large CCW figure-8 if it is not, and then into the parking lot. With only three trains left, they can't get into a traffic jam on the large figure-8, so move the one or two trains on the inter oval to the outer oval, and at the same time parking next in order train when it passes the end, into the parking lot until done.
Spent a couple of days fidgeting with the GUI. The way it is set up it is possible to assign more than one train a given color. Could prevent this with a
JavaScript, but thinking no one else would be using it, I blow it off. Included an error message and start over instead. The graphic was getting cluttered so included checkboxes to display labels or not.
I got the simulator close enough that I started thinking about a real train to control. This is when I stumbled onto DCC, JMRI and DCC++. Figuring out how to get from the physical train track and switches to those software packages to my software wandered into July as I learned more about the packages. Think I see how the pieces fit together so I bought two trains on sale and some other parts for testing. The game is on.