Turing Trains

 

computational train track layouts

menu

Average of A B

This layout calculates the average of two numbers. These are added and then shifted right to divide by 2. Two functions are used:

  1. Add function, to add A and B into S.
  2. Shift Right function, to divide S by 2.

Operation

Enter the values of A and B and start the train from the station. When the train returns and halts, the average value can be read from register S.

Layout to calculate Average of A B
average function
Click grass to pause/run train Click points to switch 0/1 Click start to reset train/points
lazy point Lazy points switch between upper 0 or lower 1 branch lines.
Trains arriving on a branch line switch the point to that line.
sprung point Sprung points allow branch line trains to join the main line.
All main line trains go straight ahead and never 'branch off'.

Notes

  1. If the sum of A and B exceeds 15 then an overflow error occours.
  2. The value of B is 'lost'.
  3. No need to clear S before a calculation as it is always over-written.
  4. The Shift Right function inserts leading 0's.

Turing Trains | cr31.co.uk | 2017

 

use your browsers 'zoom' option to enlarge layouts