Underground Challenge
Chris Hall (132) 3554 posts |
I have updated my RISC OS application to allow a virtual tour of the London Underground and it can be downloaded in beta here (it runs on both Windows and RISC OS). An itinary can be saved and reloaded and printed out (via HTML) in detail. It uses a November 1989 timetable so Aldwych, Ongar and Shoreditch are still open and as they have a peak hours only or very infrequent service this adds to the challenge. |
Chris Hall (132) 3554 posts |
I have corrected a few warts, temporarily suppressing the detailed timetable display while I get it right. The application requires RISC OS 3.60 or later (as it uses the DrawFile_Render SWI added in RISC OS 3.60). Loading an itinary (one example is provided with the application) now steps through the journey in ‘fast forward’ visiting all 270 stations in turn, marking the current station with a red blob and showing the ‘next train’ display at the relevant platform there. The whole journey is done in about 15 seconds (depending on the speed of your computer) but this can be slowed down to a more comfortable 5 stations per second by holding down the SHIFT key (and paused by also holding down the LH CTRL key).
The itinary is stored in the following form as a csv file:
Working out the destination of the next three trains at each location (which can be for several adjacent platforms) on the journey is done in machine code for speed so that it takes less than about 3cs. Using Wimp_UpdateWindow to update only the bits in the window that have changed is also much faster (but a bit more of a pain to programme) than just asking for a redraw and avoids flickering. Repeatedly drawing text can affect the appearance when SpecialFX is loaded as the new text is anti-aliased against the background which includes the previous text and its anti-aliased surrounding pixels but here the text has a surrounding rectangle which is drawn first, so clearing the background locally so this effect is avoided. Some of the text has the wrong background colour so appears fringed in yellow. I must sort this out … The latest issue of Archive (25:2 Jan/Feb 2021) describes some of the work to create this application. |
Chris Hall (132) 3554 posts |
Updated to version 6.03 now that I have received my filetype allocation from ROOL (which was extremely prompt). This problem (to visit all 270 stations in the least time) is the classic salesman problem, but made more complicated by there being an explicit timetable for any moves between nodes so that node to node time varies by time of day! I am thinking of offering a prize if anyone can beat the 17h 4m target. |
Doug Webb (190) 1158 posts |
Hi Chris, Thanks for this. I get an iniial error with UndgnD 6.03 with Nov1989TT in use in that it comes up with (Number) (Internal error Code 3325) then Many Errors Select Cancel to abort. It I ignore the cancel option and go Ok then I get to the main screen. ARMX6, 5.29 (303 Nov 2020). |
Rick Murray (539) 13806 posts |
And… Mornington Crescent! |
GavinWraith (26) 1563 posts |
Thank you for that Rick. An important piece of our cultural history. A corner of my memory says that John Jaworski may have been one of my students at Sussex University. I hope DavidS enjoys these depraved abuses of the intellect. I certainly do. |
Chris Hall (132) 3554 posts |
I get an initial error with UndgnD 6.03 with Nov1989TT in use in that it comes up with (Number) (Internal error Code 3325) That line is a call to the ‘DrawFile_Render’ SWI so I am puzzled. I don’t get that error and can’t account for it. Version 6.04 may fix it… (Wild optimism but 6.04 does fix a bug with !Help.) Optimism misplaced. If I remove all of my fonts from Boot:Resources.!Fonts on my ARMX6 except the standard ones, I also get this error. Working on it …. So Arial.Bold and Helvetica.Narrow need eradicating but it seems an odd error, perhaps I should check whether DrawFile_Render returns an error. The ‘Many errors …’ message is so that I can start the app in a single tasking way using MultiTask and immediately abort after an error and examine the content of variables rather than try to quit later from the Task Manager when some variables might have been mungled. It will disappear eventually but becomes moot if the programme never produces an error. I have now replaced Arial.Bold with Homerton.Bold (the heading of the map) and 3 point Helvetica.Narrow with 2.8 point Homerton.Medium (contents of the timetable display) and have just uploaded verion 6.05 (2205) which does now work on my ARMX6 with only the standard fonts. Now I need to work out why DrawFile_Render gives such an odd error message when it finds an unrecognised font – perhaps if I look at the V flag on return and do something about it that would be tidier. |
Chris Hall (132) 3554 posts |
Still thinking about DrawFile_Render – it is supposed to ‘render any unknown fonts in the System font at a font size that constrains them within the original bounding box’ rather than return an error ‘(Number)’. I have improved the user interface, added much more ‘Help’ information and made !UndgnD much more Style-Guide-compliant (which is a journey rather than a destination, no pun intended). I see as many as three people have downloaded it from !Store – oh well it was never going to have mass appeal. Seeing the same (almost) programme running in BASIC under both Windows and RISC OS, able to load and save each other’s itinary files, I am pleased that the playback speed of a loaded itinary is equally fast on both platforms, perhaps with RISC OS being a bit faster (and a lot faster on the Titanium). Time-critical bits are in machine code on both platforms. |
Chris Hall (132) 3554 posts |
I have updated my RISC OS application to allow a virtual tour of the London Underground and it can be downloaded in beta here (it runs on both Windows and RISC OS). I have updated the RISC OS version to version 6.20 which fixes a few bugs and now starts up ‘ready to go’. |
Chris Hall (132) 3554 posts |
RISC OS version now updated to version 6.25. This now allows a plain text input file listing the stations to be visited in order (omitting intermediate stations) and it will be analysed in about 15s to see whether the new itinerary succeeds in visiting all stations and how long it takes. Available from !Store. |