Griffy was about to finish the elusive A Times B problem, when Timothy Li scoffed at him and challenged him to a blind tic-tac-toe match! Griffy is playing as O
and Timothy is playing as X
. After a sequence of random moves, a 3 by 3 board has been filled with O
s and X
s. Both Timothy and Griffy are stuck trying to get their blindfolds off (can't write a program for that, unfortunately), so you decide to determine who wins to avoid 5 hours of blindfold-taking-off.
Note: A player wins if there are 3 of the same character in a row, column or diagonal. A player winning in multiple ways in one game is a valid win.
Input Specification
3 lines, representing a grid.
Output Specification
One line, output the string:
Error, redo
if bothO
s andX
s win,Tie
if neither player wins,Griffy
if onlyO
wins,Timothy
if onlyX
wins.
Sample Input
OOX
XOX
XXO
Sample Output
Griffy
Comments
Why does my code die for a select couple test cases?
There are two errors on line 27 in your latest submission. Please join Discord and post your problem in the "help" channel next time to avoid cluttering up the comment section.
Thanks bro :)
if the output is text, how do they see it without taking their blindfolds off?
True
Wait up. I got the code and everything working. I am consistently getting the 'Error, redo' and 'Tie' cases wrong. I made an echo program to get the inputs they're using. Plugging in the numbers results in the correct output for the case. Am I getting the string to output wrong? I'm outputting these strings for each respective scenario:
Error, redo
Tie
Timothy
Griffy
. Keep in mind that theGriffy
andTimothy
cases are AC...You should re-read the output specifications. It says to print
Error, redo
if bothO
s andX
s win, andTie
if neither player wins.Oh. That's just me being an idiot. Thanks!
why have i got only one of the many subtest wrong?
Your issue is in scenarios where both Os and Xs win.
is that a zero or an o
O
As I learned, P5 doesn't imply Timothy won all the games. -_-