Skip to content

ellehallal/java-tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Tic Tac Toe

Description

A Java application, which allows the user to play Tic Tac Toe on the command line.

Preview

  • Coming soon

Features

  • Choose to play the following games:
    • Human vs Human
    • Human vs Computer
    • Human vs Unbeatable Computer
    • Computer vs Human
    • Computer vs Computer
    • Computer vs Unbeatable Computer
    • Unbeatable Computer vs Human
    • Unbeatable Computer vs Computer
    • Unbeatable Computer vs Unbeatable Computer
  • Save the game state to a database during the game
  • Resume a saved game

Getting Started

git clone https://github.com/itsellej/java-tic-tac-toe
cd java-tic-tac-toe
mvn package
// Note: add database url, username and password
java -DDBURL=url -DDBUSERNAME=username -DDBPASSWORD=password -jar target/java-tic-tac-toe-1.0-SNAPSHOT.jar

Note: to save and retrieve games, a PostgreSQL database, with a table called "saved_games" will need to exist with the following columns set to not null:

  • id: integer (primary key)
  • game_name: text
  • current_player_mark: text
  • current_player_type: text
  • opponent_mark: text
  • opponent_type: text
  • squares: text[]

Language

The language used to create this application is Java, version 11, using the build automation tool, Maven.

Testing

The testing library used is JUnit, version 5.4.2.

Edge Cases Considered

  • Cases where the user is prompted to enter input again:
    • Game type selection: if 'start' or 'existing' is not entered
    • Loading a saved game: if the game name entered does not exist
    • Player type selection: if 'human', 'computer' or 'unbeatable' is not entered
    • Move selection: if 1-9, or 'save' is not entered during game play

Related Blog Posts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages