Tic tac toe
Three in a row, against a friend or against the computer · Game ●●○
Change these if you like
Prompt
Make a game of tic tac toe. Make it a single HTML file that opens in a browser with nothing to install and no other files. Put the CSS and JavaScript inside it. Do not use image files or any external address; use emoji or letters if you need a symbol. I play against the computer. When the computer plays, it plays well but can be beaten. Draw a three by three grid big enough to tap on a phone. Show whose turn it is. When someone wins, draw a line through the three and say who won. A full board with no winner is a draw, and say that too. Keep a running score across games and add a reset button for it. When you are done, check all eight ways to win, and check that a draw is called a draw rather than left hanging.
What it uses: One file only · Say what it is first · Decide what shows · Have it check itself
If the computer is too easy, ask it to "block my winning move before making its own".
Paste what came back
You might also like