Skip to content

josesaulguerrero/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe game

This is an amazing tic-tac-toe game where you can choose to play against a friend or against your computer 🤖. The computer uses the minimax algorithm to find the best move and way to play, so it's basically unbeatable 😎.

Table of contents

Overview

The challenge

Users should be able to:

  • Choose who they want to play against.
  • See who won after the game is over.
  • Restart the previous match after the game is over.
  • Reset the game configuration.

Screenshot

screenshot

Links

My process

Built with

  • Semantic HTML5 markup
  • Flexbox
  • Mobile-first workflow
  • Yarn - Node package manager
  • Webpack - Module bundler
  • Babel - JS code transpiler
  • React - JS library
  • Sass - For styles
  • Workbox - For managing the cache and service workers
  • react-app-rewired and customize-cra - These libraries modify the behavior of create-react-app and allow you to customize the webpack files. It must be used carefully because things can easily break.

What I learned

Building this project helped me learn to use and improve my knowledge and programming logic by:

  • Using the minimax algorithm to make your machine unbeatable.
  • Using React.Context to provide all the necessary functions.
  • Using pre-processors such as Sass.
  • Managing my service workers with Workbox.

Continued development

  • To make the computer "smarter" I use the minimax algorithm, which basically makes it unbeatable.

  • My stylesheets use Sass, a pre-processor that allows you to write cleaner CSS code and re-use your own style rules, so that you don't repeat yourself.

  • I used CSS pseudo-elements and pseudo-classes to create interesting animations when an unmarked cell is hovered.

  • To manage my service workers, I used Workbox, a set of libraries that google provides to help you covert your apps into PWAs that can be installed like a native app and work even when offline.

  • Implemented the @media (hover: hover) {} CSS media query, which is used to detect if the user's device has a cursor, to add hover transitions.

Useful resources

Author