Questions tagged [tic-tac-toe]

Tic Tac Toe is a popular exercise for beginning coders, as the finite resources and game mechanics can be easily grasped and represented in many ways. As it is a short game, it is possible to create an algorithm that never loses.

The X player usually goes first. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game. The following example game is won by the first player, X.

screenshot

1551 questions
-2
votes
1 answer

c++ - identifier not found on void tryAgain()

I'm creating a code for Tic Tac Toe, trying to use a void function for it to try again if the slot that they choose is full up. This is my code from boardInput() & tryAgain(): void boardInput() { int a; cout << "Round: " <<…
Mahi
  • 15
  • 6
-2
votes
5 answers

Tic Tac Toe how to tell user there is no winner?

I'm working in this project for 3 days and i can not figure out where I'm doing wrong if you can help me with i really appreciate your help.I'm trying to create a tic tac toe game .When I'm running the game if the player X or O wins a message will…
afgboy
  • 33
  • 1
  • 10
-2
votes
1 answer

Minimax Alogrithm for TicTacToe [python]

I'm trying to implement the minimax algorithm in my tic tac toe game. I watched several videos, analysed multiple programs with minimax algorithm and I think I do know how it works now. My program is working but it seems like the algorithm has no…
g_auge19
  • 55
  • 5
-2
votes
1 answer

Error in python code of tictactoe game

from tkinter import * import tkinter.messagebox tk=Tk() tk.title("Tic Tac Toe") click=True def checker(buttons): global click if buttons[text]==" " and click==True: buttons[text]="X" click=False elif buttons[text]==" "…
iqra
  • 1
-2
votes
1 answer

My tic-tac-toe program that uses javafx isnt working. It has no compile error or runtime error. But it still doesn't work

Here is my code. I created a 3 by 3 set of buttons. Each button once clicked changes to an X or an O. When I run my program I get a visual display of a 3 by 3 set of buttons. But once I click one of those buttons nothing happens. public class…
IbrahimLikeJava
  • 91
  • 1
  • 1
  • 9
-2
votes
1 answer

TicTacToe 5x5 in Java console

I'm writing a game of noughts and crosses with a 5x5 console sales. Faced with the following problems: 1) For some reason, game can be finished after the first stroke and the second, depending on what type of cell chosen. For example, when i…
Alexander Vasilchuk
  • 155
  • 1
  • 1
  • 12
-2
votes
2 answers

Smart computer tic-tac-toe move selection in C

I'm sure many of you are tired of seeing tic tac toe questions, but I'd appreciate any insight as to why this part doesn't function as intended. The rest of the code works great, but right here, the computer doesn't make its move, instead it just…
C. NGL
  • 1
  • 1
-2
votes
1 answer

Android Tic tac toe Gaming Winning Condition

Hello I'm new to Android Programming i need some help in Tic tac toe Game I make very simple Application that work only with Button here is The Code please have a look XML
-2
votes
1 answer

Tic Tac Toe array wrong characters

The screenshot says it all, the characters i use are correctly put inside the array. However, some other random characters are inserted in the array as well. I'm confused! main.cpp : #include "Players.h" #include "GameLayout.h" #include…
Leviathan
  • 23
  • 4
-2
votes
2 answers

python 3.5 Tic Tac Toe score count

Need help on stopping the score from resetting every game, this is my code so far and its not working. This is part of a function that checks who's the winner etc. def winner (): global Win if alist [0] == player1 and alist[1] ==…
Oscar Dolloway
  • 199
  • 3
  • 17
-2
votes
1 answer

Impossible tic tac toe game Javascript

I am working on a basic Javascript Tic Tac Toe game that lets a user play against the computer. One of the requirements for this game is that the user can never beat the computer the most they can do is tie. I'm having trouble figuring out the logic…
Blaine
  • 31
  • 6
-2
votes
1 answer

C++ Exception Minimax algorithm for Tictactoe

I'm trying to make a simple AI for playing tictactoe, but it is not working; I get an 'std::out_of_range' when the board fills up (brute forcing till the first final nodes of the first branch), and I quite didn't find a solution. If I play X at 0,0…
Ollegn
  • 2,294
  • 2
  • 16
  • 22
-2
votes
2 answers

Console tic tac toe

Alright, I've gone through some of the previous questions like this and it didn't really help me as most were using java swing and other things that are way out of my league. All I need is a functional console based tic tac toe, but I don't want to…
ddewe
  • 11
  • 3
-2
votes
2 answers

Tic tac toe programming iOS

For some reason the function the checkForWin is returning always a NO. Because of that I am not able to retrieve the winner. Else if suggest a different logic to judge winner I am using this function every time user puts up a symbol -(BOOL)…
supreet singh
  • 79
  • 1
  • 7
-2
votes
1 answer

call back in python Tic Tac Toe code

so I have this code right here for a tic tac toe program def playerID(): # asks player if want x or y letter = '' while not (letter == 'X' or letter == 'O'): letter = input('Do you want to be X or O?').upper() # first tuple…