Three word location: Difference between revisions
→{{header|Raku}}: Add some randomness, use much more of the synthetics range
Thundergnat (talk | contribs) (→{{header|Raku}}: Add a Raku example) |
Thundergnat (talk | contribs) (→{{header|Raku}}: Add some randomness, use much more of the synthetics range) |
||
Line 285:
Some letters with overlapping pronunciation are removed: c: confusable with k or s, g: overlaps with j, x: overlaps with z, q: just because, v: similar to w and we have way more than enough characters anyway.
As it is, with this alphabet we can form 512000 different 6 character "words"; 28126 is a drop in the bucket.
We don't bother to pre-calculate and store
Official pronunciation guide:
Line 302:
my $exp = @synth.elems;
sub synth (Int $v) { @synth[($v + (^18).pick * 28126).polymod($exp xx *).reverse || 0].join }
sub thnys (Str $v) { (sum %htnys{$v.comb(2).reverse} Z* 1, $exp, $exp**2) % 28126 }
Line 320:
# TESTING
for 51.4337, -0.2141, # Wimbledon
21.2596,-157.8117, # Diamond Head crater
-55.9652, -67.2256, # Monumento Cabo De Hornos
Line 332:
}</lang>
{{out}}
;Run 1
<pre>Coordinates: 51.4337, -0.2141
To 3-word:
And back: 51.4337, -0.2141
Coordinates: 21.2596, -157.8117
To 3-word:
And back: 21.2596, -157.8117
Coordinates: -55.9652, -67.2256
To 3-word:
And back: -55.9652, -67.2256
Coordinates: 59.3586, 24.7447
To 3-word:
And back: 59.3586, 24.7447
Coordinates: 29.2021, 81.5324
To 3-word:
And back: 29.2021, 81.5324
Coordinates: 28.3852, -81.5638
To 3-word:
And back: 28.3852, -81.5638</pre>
;Run 2 (same coordinates)
<pre>Coordinates: 51.4337, -0.2141
To 3-word: tapesi lawapi jowiyo
And back: 51.4337, -0.2141
Coordinates: 21.2596, -157.8117
To 3-word: worayu dupika datisi
And back: 21.2596, -157.8117
Coordinates: -55.9652, -67.2256
To 3-word: zanohu wokemo denezo
And back: -55.9652, -67.2256
Coordinates: 59.3586, 24.7447
To 3-word: hewema lenafu jabuha
And back: 59.3586, 24.7447
Coordinates: 29.2021, 81.5324
To 3-word: zipupi wuha yeyonu
And back: 29.2021, 81.5324
Coordinates: 28.3852, -81.5638
To 3-word: lorihu pasiju yaneso
And back: 28.3852, -81.5638</pre>
=={{header|Symsyn}}==
|