Skip to content

A Kotlin application, which allows the user to play a game of Tic Tac Toe on the command line.

Notifications You must be signed in to change notification settings

elletamara/kotlin-tic-tac-toe

Repository files navigation

Build Status

Kotlin Tic Tac Toe

  • A Kotlin application, which allows the user to play a game of Tic Tac Toe on the command line.

  • The user can select from various player types: human, easy computer or unbeatable computer.

    kotlin tic tac toe demo

Getting Started

This application has been created with Kotlin 1.3.50, using Gradle for build automation.

  • Install Java 11
  • In your terminal, type the following:
git clone https://github.com/elletamara/kotlin-tic-tac-toe.git
cd kotlin-tic-tac-toe
./gradlew clean build
./gradlew --console plain run

Note: If you receive a similar error to ./gradlew: Permission denied, enter chmod +x gradlew

Game Play

Game Mode / Player Type Selection

  • When starting the application, the user is prompted to enter their player type choices for both players
  • The user can select from the following player types:
    • Human - the player will be prompted to select a move by entering 1 - 9
    • Easy - a computer player, which selects an available move at random
    • Unbeatable - a computer player, which uses the Minimax algorithm to select an optimum move

Input Validation

  • Cases where the user is prompted to enter input again:
    • Player type selection: when 'human', 'easy' or 'unbeatable' is not entered
    • Move selection: when a number between 1 - 9 is not entered

Testing

  • The testing framework used is JUnit 5.
  • Tests can be run by typing ./gradlew clean test in your terminal

Test Report

The test report can be found here: ./build/reports/tests/test/index.html.

Mocking

MockK (a mocking library) is used to mock input and output in the tests.

About

A Kotlin application, which allows the user to play a game of Tic Tac Toe on the command line.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages