Perhaps some old boy remembers the Busy Beaver contest a long time ago. The goal was to configure a beaver (Turing machine) to cut as many trees as possible and then stop, in 5 states. The count includes all 1s on the Turing machine tape when the machine halts.
Why did that idea come up just now, in the Arduino forum?
It could be a nice example for real multitasking and inter-task communication on an ESP32. The tasks or jobs include:
- Turing machine enumerator
- machine checker
- emulator
- high score notifier
- machine dispatcher
-
The enumerator configures a first/next Turing machine. It should be possible to compute a unique ID for each machine and configure a machine according to a given ID.
-
A check for obvious bugs includes e.g. missing Halt state, unreachable states...
This can be done in the enumerator already, but for multi-tasking demonstration purposes can be separated into its own task (or coroutine?) -
The emulator (find a better name?) runs a configured machine until Halt or some other event. A timeout can indicate either an extraordinary busy beaver or a runaway without a chance to Halt.
Some restrictions can be added so that a local champ can be found in reasonable time. Restrictions like no negative tape positions, no more than 64K moves or tape positions...
A basic Turing machine class can be defined and extended by subclasses for the tape implementation. The fastest implementation can use a bit array in memory, slower but nicer were pixels on various displays. Then we had a "natural" tape limit in the smallest display pixel count.
-
Every new high score (candidate) can be sent to the Serial Monitor, local display or to a Web page.
-
A Web server can dispatch packages of machines (ID ranges) to participating users for parallel search for the busiest beaver.
A beaver ID could consist of 10 records/structs for the 2x5 state transitions:
1 bit write 0/1, better: keep/toggle bit on tape
1 bit move tape left/right
3 bit next state (regular 1-5, Halt state 0)
These bits can be represented by a single letter, with 10 transitions in 10 letters for a unique machine ID.
I'm waiting for comments/contributions...
