Three word location: Difference between revisions

Content added Content deleted
(→‎{{header|Raku}}: Add a Raku example)
(→‎{{header|Raku}}: Add some randomness, use much more of the synthetics range)
Line 285: 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.
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 end up with an awful lot of "words" starting with b)
As it is, with this alphabet we can form 512000 different 6 character "words"; 28126 is a drop in the bucket. To spread out the the words a bit, add a bit of randomness. 28126 fits into 512000 18 and a bit times. Add a random multiple of 28126 to the encoder then modulus it back out on decode. Will get different results on different runs.


We don't bother to pre-calculate and store them though, just generate them on the fly.
We don't bother to pre-calculate and store the words, just generate them on the fly.


Official pronunciation guide:
Official pronunciation guide:
Line 302: Line 302:
my $exp = @synth.elems;
my $exp = @synth.elems;


sub synth (Int $v) { @synth[$v.polymod($exp xx *).reverse || 0].join }
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 }
sub thnys (Str $v) { (sum %htnys{$v.comb(2).reverse} Z* 1, $exp, $exp**2) % 28126 }




Line 320: Line 320:


# TESTING
# TESTING
for 51.4337, -0.2141, # Wimbledon
for 51.4337, -0.2141, # Wimbledon
21.2596,-157.8117, # Diamond Head crater
21.2596,-157.8117, # Diamond Head crater
-55.9652, -67.2256, # Monumento Cabo De Hornos
-55.9652, -67.2256, # Monumento Cabo De Hornos
Line 332: Line 332:
}</lang>
}</lang>
{{out}}
{{out}}
;Run 1
<pre>Coordinates: 51.4337, -0.2141
<pre>Coordinates: 51.4337, -0.2141
To 3-word: bomehu bupa beyabo
To 3-word: yotema fohujo mibire
And back: 51.4337, -0.2141
And back: 51.4337, -0.2141


Coordinates: 21.2596, -157.8117
Coordinates: 21.2596, -157.8117
To 3-word: bisiju tufo belefe
To 3-word: jusafu pufemu nazaka
And back: 21.2596, -157.8117
And back: 21.2596, -157.8117


Coordinates: -55.9652, -67.2256
Coordinates: -55.9652, -67.2256
To 3-word: wemi biliwo bifali
To 3-word: mazuda yisobu denezo
And back: -55.9652, -67.2256
And back: -55.9652, -67.2256


Coordinates: 59.3586, 24.7447
Coordinates: 59.3586, 24.7447
To 3-word: boresi sufi bimiye
To 3-word: selapu najoke zifuro
And back: 59.3586, 24.7447
And back: 59.3586, 24.7447


Coordinates: 29.2021, 81.5324
Coordinates: 29.2021, 81.5324
To 3-word: biyiwa wuha bepoko
To 3-word: juyasa nutuza likula
And back: 29.2021, 81.5324
And back: 29.2021, 81.5324


Coordinates: 28.3852, -81.5638
Coordinates: 28.3852, -81.5638
To 3-word: biyehi betenu heni
To 3-word: nimale josulu tesope
And back: 28.3852, -81.5638</pre>
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}}==
=={{header|Symsyn}}==