Skip to content

Commit

Permalink
Tic-tac-toe: Explicit the game's independence from user input
Browse files Browse the repository at this point in the history
  • Loading branch information
softy-dev authored Oct 30, 2024
1 parent c54888c commit 597e30b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ We're making a Tic Tac Toe game you can play in your browser!
1. Your main goal here is to have as little global code as possible. Try tucking as much as you can inside factories. If you only need a single instance of something (e.g. the gameboard, the displayController etc.) then wrap the factory inside an IIFE (module pattern) so it cannot be reused to create additional instances.
2. In this project, 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. Take care to put them in “logical” places. Spending a little time brainstorming here can make your life much easier later!
3. If you’re having trouble, [Building a house from the inside out](https://www.ayweb.dev/blog/building-a-house-from-the-inside-out) is a great article that lays out a highly applicable example both of how you might approach tackling this project as well as how you might organize and structure your code.
3. Focus on getting a working game in the console first. Make sure you include logic that checks for when the game is over! You should be checking for all winning 3-in-a-rows and ties. Try to avoid thinking about the DOM and your HTML/CSS until your game is working.
3. Focus on getting a working game in the console first. Make sure you include logic that checks for when the game is over! You should be checking for all winning 3-in-a-rows and ties. Try to avoid thinking about the DOM and your HTML/CSS until your game is working. Don't worry about taking user input at this point either: you can pass arguments to your functions and play the game yourself to check if everything is working as intended.
4. Once you have a working console game, create an object that will handle the display/DOM logic. Write a function that will render the contents of the gameboard array to the webpage (for now, you can always just fill the gameboard array with `"X"`s and `"O"`s just to see what's going on).
5. Write the functions that allow players to add marks to a specific spot on the board by interacting with the appropriate DOM elements (e.g. letting players click on a board square to place their marker). Don't forget the logic that keeps players from playing in spots that are already taken!
6. 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 shows the results upon game end!
</div>
</div>

Check failure on line 16 in javascript/organizing_your_javascript_code/project_tic_tac_toe.md

View workflow job for this annotation

GitHub Actions / Lint project files

Multiline HTML tags should be surrounded by blank lines or code block delimiters

javascript/organizing_your_javascript_code/project_tic_tac_toe.md:16 TOP005/blanks-around-multiline-html-tags Multiline HTML tags should be surrounded by blank lines or code block delimiters [Expected a blank line or a code block delimiter (```) before the tag] [Context: "</div>"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP005.md

0 comments on commit 597e30b

Please sign in to comment.