Skip to content

Instantly share code, notes, and snippets.

@qingwei91
Created April 11, 2017 19:34
Show Gist options
  • Save qingwei91/ab339e763006c169d8386fd653936f83 to your computer and use it in GitHub Desktop.
Save qingwei91/ab339e763006c169d8386fd653936f83 to your computer and use it in GitHub Desktop.
class Server {
def main(): Unit = {
while (true) {
/**
* 1. Read user inputs which can be one of [←, ↑, →, ↓], to change the direction of snake.
* 2. Apply user input if any, which change the direction of snake.
* 3. Move snake by 1 unit space
* 4. Check if any snakes bump into enemy/wall/self, remove them from the game.
* 5. Broadcast the new game state to all clients
*/
Thread.sleep(100)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment