Esempio n. 1
0
    def test_07(self):
        """ Large boards greater than 6x6 with large k that produce solutions."""
        data = self.load_data('6-7')
        self.validate(data, 7, 7, quiz2.k_queens_coverage(7, 7))

        self.validate(data, 7, 8, quiz2.k_queens_coverage(7, 8))
        self.validate(data, 8, 8, quiz2.k_queens_coverage(8, 8))
Esempio n. 2
0
    def test_04(self):
        """ Medium boards between than 4x4 and 6x6 with k that produce solutions."""
        data = self.load_data('4')
        self.validate(data, 3, 4, quiz2.k_queens_coverage(3, 4))
        self.validate(data, 4, 4, quiz2.k_queens_coverage(4, 4))

        self.validate(data, 3, 5, quiz2.k_queens_coverage(3, 5))
        self.validate(data, 4, 5, quiz2.k_queens_coverage(4, 5))
        self.validate(data, 5, 5, quiz2.k_queens_coverage(5, 5))

        self.validate(data, 4, 6, quiz2.k_queens_coverage(4, 6))
        self.validate(data, 5, 6, quiz2.k_queens_coverage(5, 6))
        self.validate(data, 6, 6, quiz2.k_queens_coverage(6, 6))
Esempio n. 3
0
    def test_05(self):
        """ Medium boards between than 4x4 and 6x6 with k that do not produce solutions."""
        data = self.load_data('5')
        self.validate(data, 1, 4, quiz2.k_queens_coverage(1, 4))
        self.validate(data, 2, 4, quiz2.k_queens_coverage(2, 4))

        self.validate(data, 1, 5, quiz2.k_queens_coverage(1, 5))
        self.validate(data, 2, 5, quiz2.k_queens_coverage(2, 5))

        self.validate(data, 1, 6, quiz2.k_queens_coverage(1, 6))
        self.validate(data, 2, 6, quiz2.k_queens_coverage(2, 6))
        self.validate(data, 3, 6, quiz2.k_queens_coverage(3, 6))
Esempio n. 4
0
    def test_08(self):
        """ Large boards greater than 6x6 with k that do not produce solutions."""
        data = self.load_data('8')
        self.validate(data, 1, 7, quiz2.k_queens_coverage(1, 7))
        self.validate(data, 2, 7, quiz2.k_queens_coverage(2, 7))

        self.validate(data, 1, 8, quiz2.k_queens_coverage(1, 8))
        self.validate(data, 2, 8, quiz2.k_queens_coverage(2, 8))
        self.validate(data, 3, 8, quiz2.k_queens_coverage(3, 8))
        self.validate(data, 4, 8, quiz2.k_queens_coverage(4, 8))
Esempio n. 5
0
    def test_06(self):
        """ Large boards greater than 6x6 with small k that produce solutions."""
        data = self.load_data('6-7')
        self.validate(data, 3, 7, quiz2.k_queens_coverage(3, 7))
        self.validate(data, 4, 7, quiz2.k_queens_coverage(4, 7))
        self.validate(data, 5, 7, quiz2.k_queens_coverage(5, 7))
        self.validate(data, 6, 7, quiz2.k_queens_coverage(6, 7))

        self.validate(data, 5, 8, quiz2.k_queens_coverage(5, 8))
        self.validate(data, 6, 8, quiz2.k_queens_coverage(6, 8))
Esempio n. 6
0
 def test_09(self):
     """ Impossible values of k."""
     data = self.load_data('9')
     for n in range(1, 9):
         self.validate(data, 0, n, quiz2.k_queens_coverage(0, n))
Esempio n. 7
0
 def test_03(self):
     """ The 3x3 board for k in (1, 2, 3)."""
     data = self.load_data('3')
     n = 3
     for k in range(1, n + 1):
         self.validate(data, k, n, quiz2.k_queens_coverage(k, n))
Esempio n. 8
0
 def test_02(self):
     """ The 2x2 board for k in (1, 2)."""
     data = self.load_data('2')
     n = 2
     for k in range(1, n + 1):
         self.validate(data, k, n, quiz2.k_queens_coverage(k, n))
Esempio n. 9
0
 def test_01(self):
     """ The 1x1 board."""
     data = self.load_data('1')
     self.validate(data, 1, 1, quiz2.k_queens_coverage(1, 1))