Ad
  • Custom User Avatar

    Some of the bugs I faced in my solution happened only when a ship was on a bottom or right border of the desk. At the same time, fixed test don't test this (at least in Java). So I think it would be good to add such a test.

  • Default User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Default User Avatar

    I think this should be 4 or 3 kyu, my brain is exploding

  • Default User Avatar

    Need review for PHP fork

    • Added random tests (fix partial issue from here)
    • fixed ref. solution (see below)
    • better messages for failing test
    • change description to using markdown
    // current test will return 'true' for below field:
    $field =  [
      [0, 0, 0, 0, 0, 1, 0, 1, 0, 0],
      [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
      [0, 1, 0, 0, 0, 0, 0, 0, 0, 1],
      [0, 1, 0, 1, 0, 1, 0, 0, 0, 0],
      [0, 1, 0, 0, 0, 0, 0, 1, 1, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 1, 1, 1, 1, 1, 1, 1, 0], // <-- invalid
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    ];
    
  • Default User Avatar

    Python tests issue:

    Description: If more than one equally long subsequences have a zero sum, return the one starting at the highest index.

    Python Test: If more than one equally long subsequences have a zero sum, return the one starting at the lowest index.

    (Pouet36 noted this 29 days ago but did not mark it as an issue).

  • Custom User Avatar

    It has to be 4 kyu. And add regular expressions tag to this kata.

  • Custom User Avatar

    Okay, if someone has a problem that on only random tests you get "False should equal True", check if you use any constructions declared out of the main function. Fix it if you do (Helped me tho)

  • Default User Avatar

    New to codewars, so I'm not sure where to post this exactly. My code passed all test but actually shouldn't.

    Here is a testfield that is not correct, but my code sees it as fine:

    [[1, 1, 1, 0, 1, 1, 1, 0, 1, 1],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 1, 0, 1, 1, 0, 1, 0, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 0, 1, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 1, 0, 0, 0, 0]]
    

    There are 4 destroyers and the battleship is right next to destroyer.
    This is a specific 'exploit' to my code, since this can only happen when a smaller ship is placed right next to a bigger ship, but two fields down. There is an easy fix for my code. But I wondered why it passed and realized that this is a very specific case that probably doesn't show up often in the random tests.

  • Custom User Avatar

    Please try the following test cases, some are copied from other suggestions and modified.

    [TestFixture]
    public class SolutionTest
    {
        [Test]
        public void TestCase()
        {
            /*arrange*/
            int[,] field = new int[10, 10]
                           { {1, 0, 0, 0, 0, 1, 1, 0, 0, 0},
                             {1, 0, 1, 0, 0, 0, 0, 0, 1, 0},
                             {1, 0, 1, 0, 1, 1, 1, 0, 1, 0},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsTrue(res);
    
        }
        [Test]
        public void TestCase1()
        {
            /*arrange*/
            int[,] field = new int[10, 10]
                           { { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
                             { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
                             { 1, 1, 1, 0, 1, 1, 0, 0, 0, 1 },
                             { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
                             { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
                             { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                             { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                             { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
                             { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1 },
                             { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase2()
        {
            /*arrange*/
            int[,] field = new int[10, 10]
                           { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 1, 1, 0, 1, 0, 0, 1, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 1, 1, 1, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 0, 1, 1, 0, 0, 0, 1},
                             {0, 0, 1, 0, 0, 0, 0, 1, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase3()
        {
            /*arrange*/
            int[,] field = new int[10, 10]
                           { {0, 1, 1, 0, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 1, 0, 1, 0, 0, 0, 0},
                             {1, 0, 0, 0, 0, 0, 0, 1, 0, 0},
                             {0, 0, 1, 1, 1, 1, 0, 1, 0, 1},
                             {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 1, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase4()
        {
            /*arrange*/
            int[,] field = new int[10, 10]
                           { {0, 1, 1, 1, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
                             {0, 0, 0, 1, 1, 0, 0, 0, 0, 1},
                             {0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
                             {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
                             {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
                             {0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
                             {0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
                             {0, 0, 0, 0, 0, 1, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase5()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {0, 0, 0, 0, 0, 0, 1, 1, 1, 0},
                             {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 1, 1, 0, 1, 0},
                             {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
                             {0, 0, 0, 0, 0, 0, 1, 0, 1, 1},
                             {0, 0, 0, 0, 0, 0, 1, 0, 1, 0},
                             {0, 0, 1, 0, 0, 0, 1, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase6()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
                             {1, 0, 1, 0, 1, 1, 0, 0, 0, 1},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 1, 1, 0, 1, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 1, 1, 0, 0, 0, 1, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase7()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {1, 0, 0, 0, 0, 1, 1, 0, 0, 0},
                             {1, 0, 1, 0, 0, 0, 0, 0, 1, 0},
                             {1, 0, 1, 0, 1, 1, 1, 0, 1, 0},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
                             {0, 0, 0, 1, 0, 0, 0, 0, 1, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase8()
        {
            /*arrange*/
            int[,] field = new int[10, 10] {
                             {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
                             {0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
                             {1, 1, 1, 0, 1, 0, 0, 0, 0, 0},
                             {0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
                             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
                             {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
                             {1, 0, 0, 0, 0, 1, 0, 1, 1, 0},
                             {1, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsTrue(res);
        }
        [Test]
        public void TestCase9()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
                              {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {1, 0, 1, 1, 1, 0, 1, 1, 1, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 1, 1, 1, 0, 0, 1, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 1, 1, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase10()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
                              {0, 1, 1, 0, 0, 1, 0, 0, 0, 1},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
                              {0, 0, 0, 1, 0, 1, 1, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
                              {0, 0, 1, 0, 0, 0, 0, 0, 0, 1},
                              {0, 0, 1, 0, 0, 1, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
                              {1, 0, 0, 0, 0, 0, 1, 0, 0, 0},
                              {1, 0, 0, 1, 1, 0, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase11()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
                              {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
                              {0, 0, 0, 1, 0, 1, 0, 1, 0, 0},
                              {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
                              {0, 0, 1, 0, 1, 0, 0, 1, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {1, 0, 1, 0, 0, 1, 0, 0, 1, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {1, 0, 0, 1, 0, 0, 0, 0, 0, 1} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
        [Test]
        public void TestCase12()
        {
            /*arrange*/
            int[,] field = new int[10, 10] { {1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                              {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
            /*act*/
            bool res = BattleshipField.ValidateBattlefield(field);
            /*assert*/
            Assert.IsFalse(res);
        }
    }
    
  • Default User Avatar

    Please add theese to fixed tests:

    public static void main(String[] args) {
    	int[][] battleField2 = { { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
    	                         { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
    	                         { 1, 1, 1, 0, 1, 1, 0, 0, 0, 1 },
    	                         { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
    	                         { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1 },
    	                         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } };
    	System.out.println(BattleField.fieldValidator(battleField2) == false);
    	int[][] battleField3 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 1, 1, 0, 1, 0, 0, 1, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 1, 1, 0, 0, 0, 1},
    	                         {0, 0, 1, 0, 0, 0, 0, 1, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField3) == false);
    	int[][] battleField4 = { {0, 1, 1, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 1, 1, 1, 1, 0, 1, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField4) == false);
    	int[][] battleField5 = { {0, 1, 1, 1, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
    	                         {0, 0, 0, 1, 1, 0, 0, 0, 0, 1},
    	                         {0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
    	                         {0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
    	                         {0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 1, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField5) == false);
    	int[][] battleField6 = { {0, 0, 0, 0, 0, 0, 1, 1, 1, 0},
    	                         {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 1, 1, 0, 1, 0},
    	                         {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 1, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 1, 0},
    	                         {0, 0, 1, 0, 0, 0, 1, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0} };
    	System.out.println(BattleField.fieldValidator(battleField6) == false);
    	int[][] battleField7 = { {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
    	                         {1, 0, 1, 0, 1, 1, 0, 0, 0, 1},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 1, 1, 0, 1, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 1, 1, 0, 0, 0, 1, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField7) == false);
    	int[][] battleField8 = { {1, 0, 0, 0, 0, 1, 1, 0, 0, 0},
    	                         {1, 0, 1, 0, 0, 0, 0, 0, 1, 0},
    	                         {1, 0, 1, 0, 1, 1, 1, 0, 1, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
    	                         {0, 0, 0, 1, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField8) == false);
    	int[][] battleField9 = { {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                         {1, 1, 1, 0, 1, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 1, 0, 1, 1, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField9));
    	int[][] battleField10 = { {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
    	                          {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 1, 1, 1, 0, 1, 1, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 1, 1, 1, 0, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 1, 1, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField10) == false);
    	int[][] battleField11 = { {0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
    	                          {0, 1, 1, 0, 0, 1, 0, 0, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 0, 1, 0, 1, 1, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 1, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 1, 0, 0, 1, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                          {1, 0, 0, 0, 0, 0, 1, 0, 0, 0},
    	                          {1, 0, 0, 1, 1, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField11) == false);
    	int[][] battleField12 = { {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
    	                          {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 0, 1, 0, 1, 0, 1, 0, 0},
    	                          {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 1, 0, 1, 0, 0, 1, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 1, 0, 0, 1, 0, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 0, 1, 0, 0, 0, 0, 0, 1} };
    	System.out.println(BattleField.fieldValidator(battleField12) == false);
    	int[][] battleField13 = { {1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField13) == false);
    }
    

    I accidentally posted invalid solution that pass random tests once but didn't pass random test on the next attempt. If you will accept my suggestion than tests for this awesome kata will be more comprehensive. Thank you!

  • Custom User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar
  • Loading more items...