Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random
- object JappoApp extends App {
- val random = new Random(System.currentTimeMillis())
- val hiragana = Map(
- "あ" -> "a",
- "い" -> "i",
- "う" -> "u",
- "え" -> "e",
- "お" -> "o",
- "か" -> "ka",
- "き" -> "ki",
- "く" -> "ku",
- "け" -> "ke",
- "こ" -> "ko",
- "さ" -> "sa",
- "し" -> "shi",
- "す" -> "su",
- "せ" -> "se",
- "そ" -> "so"
- )
- def f(): Int = {
- val q = hiragana.keySet.toArray
- val k = q(random.nextInt(q.length))
- println(k)
- val s = readLine()
- if (s == hiragana(k)) println("OK")
- else if (s == ".") return 0
- else println("Wrong")
- return f()
- }
- f()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement