Check if 3 elements in an array are the same value
I am making a TicTacToe game (fairly easy I know but I am a beginner) and I am almost done, my problem now is I am trying to have it check if a row, a column or a diagonal of the table have the same value, and recursively keep playing if it is not. My board looks like this :
I want to enter a character into any index of a 2D array that has been printed onto the terminal from the terminal
I am fairly new to programming, and after a bunch of tutorials I decided to build my own tictactoe game.
After making the board and printing it in a table form, what I am trying to do now is to be able to sequentially enter characters (x’s and o’s) into the board from the terminal in the positions the player may want to put them in, and have it print after each entry.
getch() replacement in C
I want and searching for an alternative that could replace the getch() function of C language. I want help if any any function which can replace the getch() function from the code below or an appropriate alternative. The conio.h header file is unavailable because I used the GNU GCC compiler but I don’t want to change compilers because it will be super long to wait.
I don’t know what else to do to initialize the TicTacTo field game the fields
I’m making a TicTacTo game in the console app.
I have to give each field an index.
I did it with a dictionary where you have to enter a key and a value.
When I enter it in the field, it obviously hasn’t been added
to the list. That’s why I keep getting an error.
Does anyone know what I should try next?