Giter Club home page Giter Club logo

js-tic-tac-toe's Introduction

Tic Tac Toe Project

Live Demo: https://ts-oh.github.io/js-tic-tac-toe/

Screenshots

App Screenshot

This is a Tic-Tac-Toe project from 'The Odin Project'

  • Used: JavaScript, CSS, and HTML.

  • Implementation:

    • Your main goal here is to have as little global code as possible. Try tucking everything away inside of a module or factory. Rule of thumb: if you only ever need ONE of something (gameBoard, displayController), use a module. If you need multiples of something (players!), create them with factories.

    • Set up your HTML and write a JavaScript function that will render the contents of the gameboard array to the webpage (for now you can just manually fill in the array with "X"s and "O"s)

    • Build the functions that allow players to add marks to a specific spot on the board, and then tie it to the DOM, letting players click on the gameboard to place their marker.

    • Don’t forget the logic that keeps players from playing in spots that are already taken! Think carefully about where each bit of logic should reside. Each little piece of functionality should be able to fit in the game, player or gameboard objects.. but take care to put them in “logical” places. Spending a little time brainstorming here can make your life much easier later!

    • Build the logic that checks for when the game is over! Should check for 3-in-a-row and a tie. Clean up the interface to allow players to put in their names, include a button to start/restart the game and add a display element that congratulates the winning player!

Lessons/Comments

I learned a lot about the concept of closure and Object Oriented Programming in this project. One of the ways of using closure was through the use of factory functions. A lot like Class, inside the factory function I could create methods and variables. Furthermore expose only what I wanted by returning them as an object. Overall it was great learning experience to practice OOP concepts in Javascript.

js-tic-tac-toe's People

Contributors

ts-oh 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.