Closed JohnArochaDev closed 11 months ago
I'm not sure which is line 228, but for this line: if (turn === !2) {
try moving the not (!) to the equals to make it in inequality: if (turn !== 2) {
or simply move that code to an "else" below the if:
if (turn === 2) {
if (chart[col][row] === 4 || char[col][row] === 5) return;
} else {
return;
}
Its still not working for some reason, I have it set so that once changeTurn is activated, if its turn 2 it should activate that turn and then make a choice but its not making a choice
The function is running, and console.log's are running from it, its just not changing the values like it should
ok share the console log code and the results here
And here is the code running those logs
Im stuck because I have no errors, and the logs work, and the game works without this but I need the computer to make a turn obviously. If I can get it to work I can then add more steps for a better AI and get to polishing!
(I shared the picture so you could see the js:59 and see where the code was)
Resolved by deciding to rework the code to display two boards at a time.
What's the problem you're trying to solve?
The code Im using on line 228 isn't outputting what it should, even though it works on line 154
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
What is your best guess as to the source of the problem?
Honetly I dont get it...
What things have you already tried to solve the problem?
Ive tried a lot and Im not sure whats wrong with it
Paste a link to your repository here
https://github.com/jpjpjppj/Battleship