Giter VIP home page Giter VIP logo

tic-tac-toe's Introduction

TP1 - Tic Tac Toe

In this workshop you will build a Tic Tac Toe game using React.

Pre-requisites:

As soon as you have all of this installed, you can run the code from the application at any moment by running yarn start (hint: look at package.json to see how that works)

You can choose to rush in the next steps straight away, but if you have not done it yet, I strongly recommand that you take the time to look at all the files in the src directory, and then read all the instructions.

Also, if you did not run git init yet, now is a good time to.

Level 0 - Display -> done

Look at ./src/layouts/GameLayout.js and find a way for making its children render the informations from the state.

Level 1 - Mouseover

Make the cells change style when they are rolled over by using onMouseOver, onMouseOut and setState in ./src/components/Cell.js

  • onMouseOver -> équivalent hoover css (occurs when the mouse pointer is moved onto an element (it can be a div, a button, an input, a textarea, etc)
  • onMouseOut -> fin du survol de l'lément (occurs when the mouse pointer is moved out of an element.)

hint: you might want to transform Cell from a functionnal Component into a Class Component to achieve this.

Level 1.5 - Cell Content

Using props, make your cells display a X, a O or nothing based on the current game state.

hint: init your game state with Xs and Os to see if it is working.

Level 2 - Turns

Using onClick, make your Cells change their content based on game state's currentPlayer. A cell can only be clicked once, every time a cell is clicked currentPlayer must change.

Level 3 - No Win No Fun

Use getDerivedStateFromProps to react to state changes and check if a player has won.

hint: Tic Tac Toe

Bonii

  • Implement a small AI to play with,
  • Make the game use more rows and columns,
  • use your imagination.

tic-tac-toe's People

Contributors

clem-0000 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.