Giter Site home page Giter Site logo

matejbransky / tic-tac-toe Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 565 KB

Tic Tac Toe game

Home Page: http://tictactoe-hyperapp.surge.sh/

JavaScript 66.53% HTML 1.22% CSS 32.25%
game tic-tac-toe two-player hyperapp javascript functional-programming functional-js freecodecamp-project

tic-tac-toe's Introduction

Tic Tac Toe

(FreeCodeCamp project)

How to play

  1. Click on this link (Surge.sh) or this link (CodePen). It loads game.
  2. Select type of game and proceed next.
  3. Select marks for players by switch button and then start game.
  4. When is your turn click on any (select best option) field and it'll be marked with your selected mark.
  5. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.
  6. When game is over it starts new match with score tracked from the beginning.
  7. Button "Restart" starts new match.

How to use it

Install all packages:

npm install

It will install all needed packages.

Project structure

tic-tac-toe
├── .vscode                 // Settings for editor VS Code
├── test                    // Folder with test files
│   ├── utils.test.js
│   ├── helpers.test.js
│   ├── actions.test.js
│   └── testUtils.js          // Wrappers around test function
├── src                     // Folder with unbundled source JavaScript files
│   ├── app.js                // Main JS file with connecting other parts of app
│   ├── state.js              // State of app
│   ├── view.js               // View of app
│   ├── actions.js            // Actions of app
│   ├── events.js             // Events of app
│   ├── utils.js              // Functions for better dev
│   ├── helpers.js            // Functions for actions
│   └── style.scss
├── public                  // Output folder with index.html, style.css and
│   ├── index.html
│   ├── style.css
│   └── bundle.js
├── eval.xlsx               // AI algorithm in Excel (see also algorithm.gif)
├── algorithm.gif           // Problem with evaluation of best AI move (solution => minimax)
├── .gitignore
├── package-lock.json
├── package.json
├── .editorconfig
├── .babelrc
├── .eslintrc.js
├── webpack.config.js
└── README.md

For testing use:

npm test

It uses tape for unit tests. Tests are in test folder.

For dev mode use:

npm start

It will bundle js files from src folder to bundle folder and watch any changes in both directories.

TODO list:

  • change AI algorithm to minimax
  • update dev environment (watcher for Sass and JS)
  • update old CSS with Sass variables and mixins
  • create separated npm scripts for publishing and for development
  • add undo/redo (history)
  • add time travelling

License

ISC

tic-tac-toe's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.