Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulkner_Completed tic-tac-toe deliverable #273

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wnfaulkner
Copy link

I've fixed all of the issues I was having, but for issue (a) below, I do not understand what caused it to arise in the first place:

(a) Background color of squares was not rendering at all - Tom and I figured out that the background-color property was being overridden by 'element,' some kind of default css declaration not actually in my code. This fix was to include '!important' on line 40 of the css file. Still perplexing as to why this happened in tic-tac-toe but not in my connect4 game. And I'm still perplexed as to what the element thing is and how to use/manipulate it.

(b) The winning logic was not working so wins were not triggering the completion of the game. Issue turned out to be threefold:

  • Deriving colIdx and rowIdx. I selected the numbers from the div ids, and so js was interpreting them as strings and concatenating them as opposed to summing their numbers. Fixed by including a parseFloat on lines 77 & 78 where they are first created.

  • HTML file actually had the div id labels in the wrong order

  • countAdjacentDown & countAdjacentUp lines (99 & 100 in script.js) in my checkVerticalWin were doing too much. They included the logic of returning null or the player when the count = 2, but all they needed to do return the count.

…y labeled, and (b) colIdx and rowIdx were strings and not adding correctly inside of the countAdjacent function, so forced them to be numbers using parseFloat in the handleClick function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant