Skip to content

caglaralkiss/vanilla-xox-game

Repository files navigation

TicTacToe Fun!

This package includes vanilla JS implementation of classic Tic-Tac-Toe game.

Getting Started

Player can either compete with computer or real player. Computer mode uses Minimax algorithm to find best move from game state tree. Real opponent can compete with user via Websocket protocol. For backend part of the project, see my other repository TicTacToe-Server

Prerequisites

node(v8 or higher)
Docker(optional)

Installation

  • Firstly, you need to setup backend part of the project. Follow the instructions at TicTacToe-Server repository under Installation section
  • You can find installation for both development and production environments.
  • After your backend server is up, check url of ws server. Default is ws://localhost:8080. If you set another ip or port to run backend server, edit the URL of websocket connection at ws-url.js.
  • Go to project root directory.
  • Execute the following command for development: npm run serve. For production build, execute npm run build
  • Above scripts will produce dist folder which holds static files of the project.
  • Navigate to dist folder and open index.html with your favorite browser.

Build with Docker

Alternatively, you can create a Docker container to serve static files with Nginx server. To create a container:

  • Navigate to project directory in your local.
  • Execute the following command for development:docker build -t xox-client . For production, execute docker build --build-arg NODE_ENV_VAR=PRODUCTION -t xox-client .
  • After image is created, create a container with following command:
docker run -p 8000:80 xox-client
  • Open your favorite browser and navigate to localhost:8000.

Running the tests

  • Project uses Jest as testing framework.
  • To run unit tests, execute npm run test command on the root directory of the project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published