Giter Site home page Giter Site logo

francislangit / tic-tac-toe Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 216 KB

A web application simulating a two-player version of Tic-tac-toe. Built on vanilla JavaScript.

Home Page: https://francislangit.github.io/tic-tac-toe/

License: MIT License

HTML 7.33% JavaScript 59.63% CSS 17.28% SCSS 15.76%
css game game-development html html-css-javascript javascript tic-tac-toe tic-tac-toe-game video-game web web-application webapp webapplication website

tic-tac-toe's Introduction

Francis's GitHub stats

tic-tac-toe's People

Contributors

francislangit avatar

Watchers

 avatar  avatar

tic-tac-toe's Issues

Add additional features to the user interface

Here we'll create supplementary features that'll bring our user interface alive.

  • Create a button that restarts the game when clicked.
    • Displays "Restart" if game still ongoing.
    • Displays "Play again?" if and when game is over.
  • Create a display element that shows the result of the game when it is over. Either congratulates winner or declares draw. (This feature was built out in the last pull request).
  • If applicable, clean up the user interface such that it'll be more presentable and easier to use for users.

Create an AI that users can play against

Difficulty Modes

  1. Easy Mode - AI randomly makes a move.
  2. Hard Mode - AI makes a move based on a minimax algorithm. This should make it virtually unbeatable.

Order of Building Features

  • Before the game starts, prompt the user on their choice of game mode.
    • One-player: User plays against an AI. If chosen, user chosen between Easy Mode and Hard Mode.
    • Two-player: User plays against another user. Takes user to game board immediately once chosen.
  • Build the Easy Mode AI.
  • Build the Hard Mode AI.

Prepare repository for public release

Here we'll be preparing this GitHub repository for publicity.

  • Create a banner for README.md and social media card.
  • Fill up README.md and create a GIF for its usage section.
  • Fill up sidebar text.

Afterwards, we should confidently be able to change our repository's publicity to public.

Create and render game board array

The game board will be represented by an array with elements each representing a tile.

  • Each element can only have a value of either X or O, and not anything else.
  • The contents of the array must be rendered onto the screen as a tic-tac-toe board would look like.

For example, our array may be in the form: ['X', 'X', ' ', 'O', ' ', 'X', 'O', ' ', 'O']. Such should output:

X X 
O   X
O   O

Build features for input and game over detection

Here, we'll flesh out the features of the game allowing for a two-player mode to be played.

  • Allow players to click on the game board in order to make their respective moves.

    • There are only two players, one placing X and the other placing O.
    • Players alternate turns. If player X is done with their move, for example, the next click on an open tile should make a drawing of an O symbol, not an X.
  • Build logic that checks for when the game is over. Such is the case if either of the following are true:

    • Either player has marked 3-in-a-row.
    • No 3-in-a-rows are present but there are no more legal moves that can be made (board is full).

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.