burmese crosswords
TRANSCRIPT
CROSSWORDS
Nick Doiron - @mapmeld The Asia Foundation
BURME
E
Nick Doiron - @mapmeld The Asia Foundation
This Talk
• Generating crossword puzzles
• Adapting for NodeJS
• Unicode
• Is this a good idea?
Background: Crosswords
• Popular in 1920s, NY Times started in 1942
• Dec 18, 1941:“We ought to proceed with the puzzle… there will now be bleak blackout hours -- or if not that, then certainly a need for relaxation…”
Background: Crosswords• Revisit even a familiar problem with your present
programmer’s mind
Phase 1: the Web
<canvas>1 2
Approach 1
• Add words sequentially
• Start offset from top left
• Alternate across /down
8
1
2 4
7
6
3 5
Approach 2
• Random start position
• Random across / down
Approach 3
• Look for matchin previous words first
• Randomly sort previous words each time
1
4
2
3
5
9
8
6
7
10
Check word ends• If I’m going down
• Make sure there’s nothing above the start or below the end
• If I’m going across
• Make sure there’s nothing left of the start or right of the end
Check the sides• For each square that I’d place…
• If it’s an existing square
• Only check that the letter matches
• If it’s a new square…
• and word is going across…
• Fail if there’s a letter above or below
• Add a letter
Numbering• Word starts with a number
• That number should be:
• n, for the n-th word
• i18n_function(n), for the n-th word
• shared_start || i18n_function()
Phase 2: NodeJS
Moving to NodeJS• Biggest step: one-time sequential creation to:
• Separate browser input from program I/O:
• Enter a value and clicking button ->game.addWord()
• $(“ul.across”).append() ->Receive clue number and direction (2 Across)in callback
<canvas> on NodeJS• npm install canvas
<canvas> on NodeJS
• You need cairo installed
• Special build-pack on Heroku (and maybe other PaaS)
Phase 3: Unicode
the Unicode you know
Unicode: the dark side
• We don’t talk about:
• Unicode often legitimizes bad encodings and characters
• Non-compliant fonts and inputs
• Brahmic Scripts
Brahmic Scripts
“Myanmar” in Burmese
မ ြ န မ ာ
???
မ င' က)
ဒ ဓ = ဒ-
RegEx• Started like this:(\W(?:[ြ|ျ|||ျ|ေ||ာ|||||||း]+)?)
• npm install regenerate
Is it a good idea?A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Is it a good idea?A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
Is it a good idea?A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
က' က ကiu ;က <က=> က? ကu eကA e;ကA ကB eက?> ကA ကiu> က= ကC ;ကA> ကD> eက?A ကBE eက?A' ကi ကF ကD <ကiu> <ကi e;က Hက ;ကA က) eကB> က?iu> e;က> ကEI <ကJI ကE ;ကuJ က?i က?A> eကA' က?K> eကAI eကB ကBA ကFE eကBI <ကiu <ကE eက ;ကu <ကJ eက? က?=>
Is it a good idea?
က'က ကiu ;က
<က=> က? ကu eကA e;ကA ကB eက?> ကA ကiu> က= ကC ;ကA> ကD> eက?A ကBE eက?A' ကi ကF ကD <ကiu> <ကi e;က Hက ;ကA က) eကB> က?iu> e;က> ကEI <ကJI ကE ;ကuJ က?i က?A> eကA' က?K>
combined< 0.5%
eကAI eကB ကBA ကFE eကBI <ကiu <ကE eက ;ကu <ကJ eက? က?=>
One more thing:
ဒ=ေနရAမBA ျမMNA language ထညလiuရလA bro တiu ျမMNA languageနE႔သJးခ'ကViuပY Help ပYအJး
How Zawgyi works
Why hate a font?
• Different uses for same code-points
• like Dvorak as a font
• Overwrites minority languages
Fixing Zawgyi
!
(software and
hardware)
Thanks!
npm install crossword
Nick Doiron - @mapmeld The Asia Foundation