#Test task for Data Monsters
It is a test task (or a probation project) was performed as a part of application to a Scala Developer position of some company.
The project split in to subproject:
- streams/ where all main use-cases implemented by use of true Akka Actors
- actors/ where all main use-cases implemented by use of Akka Streams
sbt actors/run
First player
telnet localhost 6600
and second one
telnet localhost 6600
Type SPACE and ENTER when see "3"
sbt streams/run
First player
stty -icanon && netcat 127.0.0.1 6600
and second one
stty -icanon && netcat 127.0.0.1 6600
##Requirements Use Scala/Akka.
##User stories
- Player connects game server by use of telnet. 1.1. It's assumed that player's terminal uses UTF-8 encoding
- After the connection is established the game greets the player with message "Привет! Попробую найти тебе противника" 1.1. hereinafter all messages is ended by "\n"
- The server chooses other player among already connected players waiting for a peer competitor
- After the peer found the server notifies both players by the message "Противник найден. Нажмите пробел, когда увидите цифру 3"
- In randomized interval (2sec < T < 4sec) the server sends messages "1", "2" or "3" in random order to players
- After "3" is sent, the game waits till one of the player sends space symbol.
- The first player who sent a space symbol is a winner. 1.1. The winner receives a message "Вы нажали пробел первым и победили". 1.1. The looser receives a message "Вы не успели и проиграли". 1.1. Both are disconnected from the game.
- If a player sends space symbol before the "3" was sent to him he becomes a looser 1.1. A message "Ваш противник поспешил и вы выйграли" is sent to the winner 1.1. A message "Вы поспешили и проиграли" is sent to the looser 1.1. Both are disconnected from the game.
##Assumption
- For Pure Actors: Message from a player perspective is a number of symbols ended by newline character, so to send SPACE a player must type SPACE and ENTER from newline
- The game ignores any strings except SPACE (" ")
- For Akka Streams chosen is
netcat
because it was simpler for me to turn off user input buffering between a terminal and this application.