diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-27 12:29:43 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2024-11-27 12:29:43 +0200 |
commit | 98407b35ff477f372baa92bf582b90a961d4ad16 (patch) | |
tree | bb58925090075d1e9e30dd1593547db2cbe03bb6 /src/scalevalapokalypsi/UI/main.scala | |
parent | 38900e0b291d5e0f59afaaa239cd237f733b6588 (diff) | |
download | scalevalapokalypsi-98407b35ff477f372baa92bf582b90a961d4ad16.tar.gz scalevalapokalypsi-98407b35ff477f372baa92bf582b90a961d4ad16.zip |
Added part of story & improved singing with multiple verses & hemingway distance
Diffstat (limited to 'src/scalevalapokalypsi/UI/main.scala')
-rw-r--r-- | src/scalevalapokalypsi/UI/main.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/scalevalapokalypsi/UI/main.scala b/src/scalevalapokalypsi/UI/main.scala index 7368803..e172f24 100644 --- a/src/scalevalapokalypsi/UI/main.scala +++ b/src/scalevalapokalypsi/UI/main.scala @@ -121,12 +121,13 @@ def startClient(client: Client): Unit = while !hasQuit do sleep(POLL_INTERVAL) val line = stdinReader.newLine() - if line.map(_.length).getOrElse(0) > 1024 then + if line.toOption.map(_.length).getOrElse(0) > 1024 then Printer.printLn("Virhe: Syötteesi oli liian pitkä.") - else if line == Some("quit") then + else if line == Right("quit") || line == Left(true) then hasQuit = true + println("Poistut pelistä.") else - val gameEvent = client.clientStep(line) + val gameEvent = client.clientStep(line.toOption) Printer.printGameEvent(gameEvent) if !gameEvent.gameIsOn then hasQuit = true |