Ad
  • Custom User Avatar

    This kata does not perform normal brace matching: it considers [) a brace match that is invalid. In any normal brace matching if braces are unmatched it just goes till the end.

    The kata's brace matching behaviour is flawed anyway as it will fail to cases like [)].

    (Also, the kata does not specify what are considered open/close brace characters, which are [({ and ])} respectively.)

  • Custom User Avatar

    There are no random tests.

  • Custom User Avatar
    tests/Fixture.cs(152,49): error CS1061: 'Brace' does not contain a definition for '_InnerBraces' and no accessible extension method '_InnerBraces' accepting a first argument of type 'Brace' could be found (are you missing a using directive or an assembly reference?)
    
  • Default User Avatar

    Yesterday I had to go.. Anyway, my bad! I was wrongly assuming that board arrays initialization was supposed to respect board visualization so I got columns and rows swapped. Again sorry for wasting your time.
    That said, maybe it's supposed to be this way as part of the challenge but since the description is so well done in my opinion could be a good thing to point out that first array is first column etc.

  • Default User Avatar

    Thanks for the reply. My point is: in TestVsNextFreeStart1, if the last board (which my code fails) is the same board I have explicited in TestOneField1 I don't get how could the same code reacts differently on the same input?

  • Default User Avatar

    Hi I'm not sure that is the same issue but, I'm facing a strange behavior.
    I changed the first test (and added a newone) like this:

    [Test]
        public void TestOneField()
        {
          var board = new int[][] 
          {
            new int[] { 2, 0, 2 },
            new int[] { 1, 1, 2 },
            new int[] { 1, 2, 1 }
          };
          Assert.AreEqual(new int[] { 1, 0 }, TTTSolver.TurnMethod(board, 1));      
        }
        
        [Test]
        public void TestOneField1()
        {
          var board = new int[][] 
          {
            new int[] { 2, 2, 0 },
            new int[] { 0, 1, 0 },
            new int[] { 1, 0, 0 }
          };
          Assert.AreEqual(new int[] { 2, 0 }, TTTSolver.TurnMethod(board, 1));      
        }

    In both cases test is passed and because of the 2 success, I'm guessing I'm not wrong in interpreting board and coordinates.

    During "TestVsNextFreeStart1"
    this is what happens:

    Game starts...
    Player 1 starts...
    Round 1 - Player 1
    Turn: 1, 1
     0 | 0 | 0
    ---+---+---
     0 | 1 | 0
    ---+---+---
     0 | 0 | 0
    Game is running...
    -------
    Round 1 - Player 2
    Turn: 0, 0
     2 | 0 | 0
    ---+---+---
     0 | 1 | 0
    ---+---+---
     0 | 0 | 0
    Game is running...
    -------
    Round 2 - Player 1
    Turn: 0, 2
     2 | 0 | 0
    ---+---+---
     0 | 1 | 0
    ---+---+---
     1 | 0 | 0
    Game is running...
    -------
    Round 2 - Player 2
    Turn: 1, 0
     2 | 2 | 0
    ---+---+---
     0 | 1 | 0
    ---+---+---
     1 | 0 | 0
    Game is running...
    -------
     System.Exception : Field 0/2 was not empty!

    Shouldn't the last board tested be the same as my TestOneField1? If it's not how could I pass TestOneField?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution