<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Typing Sushi Lab</title>
    <description>The latest articles on DEV Community by Typing Sushi Lab (@typingsushilab).</description>
    <link>https://dev.to/typingsushilab</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4212019%2F74fa5aa5-38e5-4719-a16c-4baeff7cb868.png</url>
      <title>DEV Community: Typing Sushi Lab</title>
      <link>https://dev.to/typingsushilab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/typingsushilab"/>
    <language>en</language>
    <item>
      <title>Designing fair romaji acceptance for a browser Japanese typing game</title>
      <dc:creator>Typing Sushi Lab</dc:creator>
      <pubDate>Tue, 10 Nov 2026 00:14:04 +0000</pubDate>
      <link>https://dev.to/typingsushilab/designing-fair-romaji-acceptance-for-a-browser-japanese-typing-game-akd</link>
      <guid>https://dev.to/typingsushilab/designing-fair-romaji-acceptance-for-a-browser-japanese-typing-game-akd</guid>
      <description>&lt;p&gt;Building a browser typing game for Japanese learners sounds simple until you hit &lt;strong&gt;romaji variants&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Learners type the same mora many ways: &lt;code&gt;shi&lt;/code&gt; vs &lt;code&gt;si&lt;/code&gt;, &lt;code&gt;chi&lt;/code&gt; vs &lt;code&gt;ti&lt;/code&gt;, &lt;code&gt;fu&lt;/code&gt; vs &lt;code&gt;hu&lt;/code&gt;, long vowels with or without &lt;code&gt;u&lt;/code&gt;, and ん before consonants. If the game only accepts one spelling, practice becomes frustration instead of muscle memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we wanted
&lt;/h2&gt;

&lt;p&gt;For &lt;a href="https://sushida.org/" rel="noopener noreferrer"&gt;寿司打&lt;/a&gt; (Sushida), a free browser sushi typing practice site, the goals were:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accept common Hepburn / kunrei-style variants learners actually use&lt;/li&gt;
&lt;li&gt;Keep scoring fair (no free points for wrong kana)&lt;/li&gt;
&lt;li&gt;Stay entirely client-side (no iframe embeds of third-party games)&lt;/li&gt;
&lt;li&gt;Work on a phone keyboard and a physical JIS/US layout&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Acceptance table, not string equality
&lt;/h2&gt;

&lt;p&gt;Instead of comparing raw input to a single canonical string, we normalize keystrokes through a small &lt;strong&gt;acceptance table&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Map each target mora to a set of allowed romaji spellings&lt;/li&gt;
&lt;li&gt;Consume the longest matching spelling from the left (greedy but bounded)&lt;/li&gt;
&lt;li&gt;Reject mid-mora garbage early so the falling sushi does not “stick”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is closer to how IME romaji engines think than to &lt;code&gt;input === answer&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Edge cases that surprised us
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ん before な行&lt;/strong&gt;: &lt;code&gt;nna&lt;/code&gt; vs &lt;code&gt;n'na&lt;/code&gt; — we accept both when the next mora starts with n&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;長音&lt;/strong&gt;: &lt;code&gt;ou&lt;/code&gt; / &lt;code&gt;oo&lt;/code&gt; / ASCII approximations for some learners&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;促音&lt;/strong&gt;: doubling the consonant (&lt;code&gt;kitte&lt;/code&gt;) must not steal the next mora’s first letter incorrectly&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixed scripts&lt;/strong&gt;: if someone pastes kana mid-word, fail soft and show the expected romaji hint&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why not just use an IME?
&lt;/h2&gt;

&lt;p&gt;IME composition is great for writing, terrible for a falling-object timing game. Composition windows steal focus and break frame timing. We keep the game on raw keydown and teach romaji explicitly — that is the skill people practice on &lt;a href="https://sushida.org/" rel="noopener noreferrer"&gt;寿司打&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;If you ship a Japanese typing practice game in the browser, invest in the &lt;strong&gt;acceptance table&lt;/strong&gt; before the particle effects. Fair input parsing is the product.&lt;/p&gt;

&lt;p&gt;Free to try: &lt;a href="https://sushida.org/" rel="noopener noreferrer"&gt;https://sushida.org/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>gamedev</category>
      <category>japanese</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Handling Japanese Romaji Input in a Browser Typing Game: Lessons Learned</title>
      <dc:creator>Typing Sushi Lab</dc:creator>
      <pubDate>Wed, 28 Oct 2026 03:24:59 +0000</pubDate>
      <link>https://dev.to/typingsushilab/handling-japanese-romaji-input-in-a-browser-typing-game-lessons-learned-4gn2</link>
      <guid>https://dev.to/typingsushilab/handling-japanese-romaji-input-in-a-browser-typing-game-lessons-learned-4gn2</guid>
      <description>&lt;p&gt;Japanese typing games look simple: a word appears, you type it, you score. But anyone who has built one quickly finds that Japanese input is full of edge cases. While working on &lt;a href="https://sushida.org/" rel="noopener noreferrer"&gt;寿司打 (Typing Sushi Lab)&lt;/a&gt;, a free browser typing game where you type words before the sushi plates roll away, we ran into most of them. Here's what we learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. One kana, many valid spellings
&lt;/h2&gt;

&lt;p&gt;The word しんぶん can be typed as &lt;code&gt;shinbun&lt;/code&gt;, &lt;code&gt;sinbun&lt;/code&gt;, &lt;code&gt;shinnbunn&lt;/code&gt;, or &lt;code&gt;sinnbun&lt;/code&gt;. つ can be &lt;code&gt;tsu&lt;/code&gt; or &lt;code&gt;tu&lt;/code&gt;, ち can be &lt;code&gt;chi&lt;/code&gt; or &lt;code&gt;ti&lt;/code&gt;, and じゃ can be &lt;code&gt;ja&lt;/code&gt;, &lt;code&gt;jya&lt;/code&gt;, or &lt;code&gt;zya&lt;/code&gt;. If your game only accepts one spelling, players who learned a different romaji system get frustrated fast.&lt;/p&gt;

&lt;p&gt;The fix is to store each word as a sequence of kana, not a romaji string, and keep a table of accepted romaji patterns per kana. On every keystroke, filter the candidate patterns for the current kana by the prefix the player has typed so far.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;table&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;し&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;si&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ci&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;つ&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tsu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ち&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;chi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ti&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ん&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;n'&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. The tricky ん (n)
&lt;/h2&gt;

&lt;p&gt;A single &lt;code&gt;n&lt;/code&gt; is valid for ん only when the next kana doesn't start with a vowel, &lt;code&gt;y&lt;/code&gt;, or &lt;code&gt;n&lt;/code&gt;. So in かんい you must type &lt;code&gt;nn&lt;/code&gt;, but in しんぶん a single &lt;code&gt;n&lt;/code&gt; before &lt;code&gt;b&lt;/code&gt; is fine. We resolve this lazily: accept the single &lt;code&gt;n&lt;/code&gt;, and when the next keystroke arrives, check whether it would make the previous &lt;code&gt;n&lt;/code&gt; ambiguous.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Small tsu (っ) doubles the next consonant
&lt;/h2&gt;

&lt;p&gt;きって is &lt;code&gt;kitte&lt;/code&gt;: the っ is typed by doubling the first consonant of the following kana. You also need to accept &lt;code&gt;ltu&lt;/code&gt; / &lt;code&gt;xtu&lt;/code&gt; for players who type the small kana explicitly.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep feedback instant
&lt;/h2&gt;

&lt;p&gt;Players notice even small input lag. We avoid re-rendering the whole word each keystroke; instead we update only the typed and remaining spans. On mobile, a hidden input element keeps the virtual keyboard open without layout jumps.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Make it fun, not a test
&lt;/h2&gt;

&lt;p&gt;Mechanics matter more than polish. A time pressure element (in our case, plates of sushi moving along a conveyor) turns drilling into a game, and showing keys-per-second and miss counts after each round gives players a reason to try again.&lt;/p&gt;

&lt;p&gt;If you want to see these rules in action, you can try &lt;a href="https://sushida.org/" rel="noopener noreferrer"&gt;寿司打&lt;/a&gt; in any browser, no install needed. I'd love to hear how others handle IME-style input or multi-spelling matching in their own projects.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>gamedev</category>
      <category>webdev</category>
      <category>japanese</category>
    </item>
  </channel>
</rss>
