Talk:State Machines -or- How to solve the maze with 2 gates

Discussion page of State Machines -or- How to solve the maze with 2 gates

Programatic Implementation[edit source]

This is the overture 1 / "Arm" code I got when implementing the solution as a program. My implementation is 791 gates and has a "unary logic unit" which takes a single operand from register 1 and stores to register 3, ignoring register 2. It should be noted that this solution is 24 instructions which is longer than my implementation of the normal algorithm (19 instructions) and performs much worse because the entire code is run at each step where the normal algorithm only executes a fraction of the code at each step.

#input and mask
in_to_reg2
2
reg0_to_reg1
and
#compute bits #1 and #2
reg3_to_reg1
# keep the input token for a little longer. 
reg2_to_reg0
reg5_to_reg2
or
reg3_to_reg1
shl                       <<<< uses the ULU 
# store partial solution in reg4.
reg3_to_reg4
#compute bit #0
reg5_to_reg1
reg0_to_reg2
nor
1 
reg0_to_reg1
reg3_to_reg2
and 
# save state
reg3_to_reg5
# generate output token
reg4_to_reg2
reg3_to_reg1
or
reg3_to_out
# return to top 
0
jump

AlonzoTG (talk) 08:16, 7 January 2024 (UTC)