⚠️This site is a mirror of Guy Walker's Stagecast⚠️

Turing Trains | Isometric | Wang Tiles | Maze Arrays | i Logo

HOME

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. Accumulator function, to add A to B.
  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 layout to pause/run train Click points to switch 0/1 Click start circle 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.

cr31.co.uk

 

zoom in to enlarge layouts