Tic Tac Moe!

View as PDF

Submit solution

Points: 6 (partial)
Time limit: 1.0s
Memory limit: 16M

Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
Junior 4 — Tic Tac Moe!

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 Os and Xs. 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 both Os and Xs win,
  • Tie if neither player wins,
  • Griffy if only O wins,
  • Timothy if only X wins.

Sample Input


Sample Output



  • 3
    balathegreat999  commented on May 28, 2020, 4:38 p.m.

    if the output is text, how do they see it without taking their blindfolds off?

  • 0
    vpro8725  commented on Oct. 25, 2019, 7:38 p.m.

    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 the Griffy and Timothy cases are AC...

    • 1
      Dingledooper  commented on Oct. 25, 2019, 8:21 p.m.

      You should re-read the output specifications. It says to print Error, redo if both Os and Xs win, and Tie if neither player wins.

      • 1
        vpro8725  commented on Oct. 25, 2019, 8:33 p.m.

        Oh. That's just me being an idiot. Thanks!

  • 0
    amine_20  commented on Feb. 27, 2019, 12:22 p.m.

    Can someone tell me why case 4 in batches 1 and 5 are wrong ??

  • 0
    DA_BIG_MO  commented on Jan. 9, 2019, 12:19 a.m.

    why have i got only one of the many subtest wrong?

    • 2
      geese  commented on Jan. 9, 2019, 1:36 p.m.

      Your issue is in scenarios where both Os and Xs win.

  • -3
    DA_BIG_MO  commented on Jan. 8, 2019, 4:30 a.m.

    is that a zero or an o

  • -1
    Kirito  commented on March 22, 2016, 10:20 p.m.

    As I learned, P5 doesn't imply Timothy won all the games. -_-