Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,39 @@
function WheelCreator(wheel: string): () -> char;
begin
var index := 1;
result := function(): char ->
begin
result := wheel[index];
index := if index >= wheel.Length then 1 else index + 1;
end;
end;
function TurnWheels(primary: char; wheels: dictionary<char, () -> char>): sequence of char;
begin
while true do
begin
var turn := wheels.Get(primary)();
while not turn.IsDigit do
turn := wheels.Get(turn);
yield turn;
end;
end;
begin
var allwheels :=
||('A', '123')|,
|('A', '1B2'), ('B', '34')|,
|('A', '1DD'), ('D', '678')|,
|('A', '1BC'), ('B', '34'), ('C', '5B')||;
foreach var wheels in allwheels do
begin
foreach var w in wheels do
writeln(w[0], ': ', w[1]);
println('Generates:');
var t := TurnWheels(wheels[0][0], wheels.ToDictionary(x -> x[0], x -> WheelCreator(x[1])));
println(t.Take(20));
println;
end;
end.