Skip to content

aqib1/Takeaway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

Game Of Three

Requirements

To run this application, you'll need:

  • Java 11 SDK
  • A modern web browser with JavaScript enabled.
  • Docker (in the case you want to run dockerrun.sh)

Running the Application

The application can be run from within a modern Java IDE with the entry class being GOTApplication.java. The application can also be run using Maven by executing the command: mvn spring-boot:run in the root folder of the application.

Using the Application

The application starts up on port 8081. Pointing your web browser to http://localhost:8081 should present the application's landing page.

To connect to the game engine, a username is required to identify each connected player. Feel free to type any username of your choosing. Please note that no two players can have the same username.

The game/application can be played in both automatic and manual modes. Use the Game Mode dropdown to specify your preferred mode. Please note that this value can be updated at any point during game play.

After specifying both username and game mode, clicking Connect button connects you to the game engine (via a websocket). This action will attempt to automatically pair you with a player if another connected player is available. If not, you will be presented with a message stating that you will have to wait for another player to become available. Once you have been paired,a game play session will commence.

In automatic game mode, a random number is generated on behalf of the 1st player for the game to commence. In manual mode the player is required to specify the random number (captured through an input field).

After the random number has been generated, both players can go ahead with adding (either automatically or manually) the required number (-1, 0 or 1) to the values they receive on subsequent instructions. This exchange continues until there is a winner. Players can choose to rematch after a game session has been concluded.

Messages during game play are displayed in a game board.

Docker

Docker run file is also added in project. Just run your docker on your system and run dockerrun.sh file from project. Application will be up on 8081.

Testing

Both unit and integeration tests are added. You can find those in sperate folders.

Technologies

  • Java 11
  • Websockets with spring
  • Domain driven development
  • Test driven development
  • Junit4 & Junit5
  • Stamped lock (Optimistic locking)
  • Initialization on demand holder pattern
  • Builder pattern
  • Method chaining
  • Single responsibilities
  • Docker