Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tpgillam/organ_stop_cycle
Compute cycles through all motions of N organ stops
https://github.com/tpgillam/organ_stop_cycle
Last synced: 16 days ago
JSON representation
Compute cycles through all motions of N organ stops
- Host: GitHub
- URL: https://github.com/tpgillam/organ_stop_cycle
- Owner: tpgillam
- License: mit
- Created: 2021-04-17T11:22:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-17T11:51:21.000Z (over 3 years ago)
- Last Synced: 2023-03-05T21:01:04.146Z (almost 2 years ago)
- Language: Julia
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# organ_stop_cycle
Compute cycles through all motions of `n` organ stops.
## Problem statement
Consider `n` organ stops.
Each can be in (`0`) or out (`1`), and the vector of positions for all stops is denoted the "state".
There are therefore `2^n` possible states.A single stop can perform one of these three actions:
1. `-`: Move in
1. `+`: Move out
1. `.`: Stay where it is (which may be "stay in" or "stay out" - we do not distinguish them).Note that the *valid* actions depend on the state of the stop (e.g. you can't move a stop out that is already "out").
A "motion" is defined to be a vector of actions, one for each stop.
There are therefore `3^n` possible motions.Form an algorithm which (given a value of `n`) generates the shortest ordered list of states such that its traversal generates every possible motion at least once.
The final state should be the same as the initial state.## Why?
You are building an electric organ from scratch, and rigging up a set of real stops to solenoids.
You may then wish to ensure that all possible transitions are tested as quickly as possible.## Solution
Run `organ_stops.jl`, which will populate the contents of the `output` directory.
It seems likely that this algorithm meets the lower bound for any `n`; it will throw an exception if it does not.
This can *probably* be proved by appealing to a theorem which states that an Eulerian cycle exists iff all nodes in a graph are even.The output by default shows the state and the subsequent transition in a hopefully intuitive notation, e.g. for `n = 2`:
```
00 ++
11 --
00 +.
10 -+
01 +-
10 -.
00 .+
01 .-
00 ..
00
```