4 kyu

A simple Tic-tac-toe class

344 of 353Cito
Description
Loading description...
Games
Puzzles
Object-oriented Programming
  • Please sign in or sign up to leave a comment.
  • shaman4d Avatar

    Write code, write tests...why need this kata I dont get it, sorry...

  • Blind4Basics Avatar

    the Computer plays against itself section makes no sense: the computer should win when the ascending diagonal is full. Currently, the tests expect [..., "Your move?"]. If those tests are "correct" the computer could never win.

  • zLuki Avatar

    I enjoyed this Kata very much, it's a pity that it's so old and therefore has no test cases.

  • Voile Avatar
  • FArekkusu Avatar

    No random tests.

  • FArekkusu Avatar

    The description is still a terrible mess, and the sample tests are absent.

  • FArekkusu Avatar

    No sample tests.

  • FArekkusu Avatar

    5 years have passed, and the description is still nonsense about "player playing against the computer". The whole thing should be simplified and rewritten into 1-2 paragraphs at most clearly stating what the task is.

  • Aquila Avatar

    Well, I'll give you this at least: when you finish this kata you really feel like you earned it. :D

  • maliknur Avatar

    Nice kata, but took more than one hour to complete, some unit tests would be handy!

  • cjmochrie Avatar

    This problem is frustrating and annoying because if the gotcha about a computer playing itself.

    Parsing every single line of the description should not be necessary to start working away at a problem.

    At least include the computer playing against itself in the example behavior.

  • brunolm Avatar

    Please add at least 1 sample test

  • asdf123asdf123 Avatar

    I think this kata's discription is written in a way to intentionally decieve the user. Throughout the description, the author constantly refers to the player and the computer which gives the impression that once the computer has made its move, it waits for the player to input the next. This is untrue. If your solution makes it past the first 25 or so tests, the remaining tests are written to test the computer playing itself. This is an important criteron that is not mentioned at all and its omission can drastically change the programmer's approach to solve the challenge. There are a lot of comments on this kata which point out that there is no mention that a successful solution must include a way for the computer to play itself which leads me to believe that most people will fall into this "gotcha". Please update the description to spellout exactly what the solution requires.

  • superbob Avatar

    This comment has been hidden.

  • ohager Avatar

    I am confused with the draw state. In one test case [8, 'Draw!'] is expected in another [0, 'Draw!']. I thougt it is always [0, 'Draw!']. I dunno how to deal with it! Some hints?

  • jacobb Avatar

    Definitely enjoyed this one. Now I'll have to watch to see if anyone provides a solution with less code.

  • aelg Avatar

    Very nice i think this was a nice kata. I also missed the switching side bit, but that probably was because i read the description to fast. Nice with the hint in the testcase that fails if this happens,

  • laoris Avatar

    Excellent, detailed test cases. Thanks, Cito.

  • ssineriz Avatar

    Nice kata! More a 5 kyu IMHO. I fell too into the "Computer changes side playing with itself" trap. Well, I actually started with a check that prohibited computer moves after the first one, returning "illegal move", then I saw that a computer vs. computer was asked to be accepted by the test fixture.
    I feel it would be more coherent at this point if the solution accepts either computer vs. computer or computer vs. human matches: my solution, for instance, would erroneously accept a human move after two or more computer moves without batting an eye (ttt.move(); ttt.move(); ttt.move(4) // -> [0,"Illegal move"]).

  • frenetic_be Avatar

    Nice work! I think there is a mistake in one of the examples:

    ttt.move(4) // -> ["Game ended"]

    while i guess it should say

    ttt.move(4) // -> [0,"Game ended"]

  • Cito Avatar

    When "playing against itself", the computer changes sides (O and X) after every move (i.e. alternates between O and X instead of always playing O or X). The description says somewhere that move() shall change sides, so I think this is not a bug.

  • OverZealous Avatar

    This comment has been hidden.