Tic Tac Toc game board - HELP


why does it only print the " l l l l " once?

I tried setting up a loop, maybe I could have done it more efficient, cuz it didnt work >.<

Any ideas how to solve it?

You are printing all items in verti_line_1 with for loop and you printed them all :slight_smile:
Your for loop is made for looping inside verti_line_1 array and only for that array. When it printed all items from that array out, the loop ends.

But i wrote,
"if i == 6: (6 is the last item in the list)
then it should go onto another line “\n”
and start over verti_line_1
until row = 3 it should stop

How can I fix it to go through the 6 command

That is not how this works :slight_smile:
You set your loop to go over for element in some_array and for loop will only log out elements from that array and not any other else. It won’t go to another one or do something you did not tell it to do.
I can understand your logic but that is not how programming logic works.
You could put all that strings from all arrays in 1 array. And then when you loop over it will output every item in that array. It doesn’t matter if it is 1 element or 100 of them.

Could u help me, how should I rewrite it probaly to make it loop as u could see I tried.

If you wanna have 1 big output of all that arrays, then you probably need to loop over each one and push values in 1 new array that you will print out all that values together.

Or if it doesn’t matter, you can loop over arrays 1 by 1 and print them out 1 by 1.

why the flag? You got the solution, so? that is good right? Just make a reply here that you solved the problem

Sorry I am guite new to this site. I think I had to write a reason why I deleted my comment. Wont happen again.

It always comes back to for loop.
If you loop like for(var i = 0; i <3; i++){} your i will have values

0 in first loop,
1 in second loop,
2 in third loop,
and 3 when it goes out of the loop.

So you use i as a number placement and go

for 1. array of arrays -> push value[0], value[1], value[2], value[3] in it.
then go to next array in arrays and again push values from 0 to 3…

thankfully not, then we would have a lot of flags. They are your replies, you can delete them whenever you feel like it

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.