+ 1
Can you help me organize my function (for loops)
Hello! So I created a Tic Tac Toe code and I decided to make it look better so I changed the names, created valid input and more. But I relized that I have like 100 line code that could be done in 50 but I really couldn't get the code to work with for loops. I want to replace the "move" function so I will be able to create for example 2 loops and not just type for example game[0][0] == 'X' and so on and so forth if someone can help me figure this out I'll be greatful. Here's the code: https://code.sololearn.com/cOcerAjfI9le/#cpp I tried doing this but the output is just the game prints 'X' all over the screen: https://code.sololearn.com/cyt6F828N6r3/#cpp p.s I will be happy for other title if you have in mind
7 Respuestas
+ 2
~ swim ~ I meam the win in total is pretty much the same amount of lines when you look on it pretty much although yours is much better and thank you so much I didn't test it yet but looks very good
+ 1
@~ swim ~ I understand what you did but I don't understand why is it when i do
int row = (inputPlayerMove - 1) / 3; it gives me rows and
int col = (inputPlayerMove - 1) % 3; gives me col
+ 1
~ swim ~ I got it thanks