Ejemplo n.º 1
0
    def testTouchToSolve(self):
        board.touch(self.b, (4,1))
        self.assertEqual(scoreboard(self.b), 30)

        b2 = board.newboard(
            """
            4 4 2 2 1
            0 0 2 3 4
            0 0 0 4 4
            3 0 0 3 4
            0 0 0 0 4
            3 0 0 0 3
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (1,4))

        b2 = board.newboard(
            """
            4 4 3 0 0
            0 0 3 0 0
            0 0 0 0 0
            4 0 0 0 0
            0 0 0 0 0
            4 0 0 0 0
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (0,1))

        b2 = board.newboard(
            """
            0 0 0 0 0
            0 0 4 0 0
            0 0 0 0 0
            0 0 0 0 0
            0 0 0 0 0
            0 0 0 0 0
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (1,2))
        
        b2 = board.newboard(
            """
            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
            """)
        self.assertEquals(self.b, b2)
Ejemplo n.º 2
0
    def testTouchToSolve(self):
        board.touch(self.b, (4, 1))
        self.assertEqual(scoreboard(self.b), 30)

        b2 = board.newboard("""
            4 4 2 2 1
            0 0 2 3 4
            0 0 0 4 4
            3 0 0 3 4
            0 0 0 0 4
            3 0 0 0 3
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (1, 4))

        b2 = board.newboard("""
            4 4 3 0 0
            0 0 3 0 0
            0 0 0 0 0
            4 0 0 0 0
            0 0 0 0 0
            4 0 0 0 0
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (0, 1))

        b2 = board.newboard("""
            0 0 0 0 0
            0 0 4 0 0
            0 0 0 0 0
            0 0 0 0 0
            0 0 0 0 0
            0 0 0 0 0
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (1, 2))

        b2 = board.newboard("""
            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
            """)
        self.assertEquals(self.b, b2)
Ejemplo n.º 3
0
 def testTouchOn01(self):
     board.touch(self.b, (0,1))
     b2 = board.newboard(
         """
         4 3 2 2 1
         0 4 1 3 4
         0 4 0 3 4
         2 0 0 1 4
         3 4 0 4 2
         1 1 0 4 1
         """)
     self.assertEquals(self.b, b2)
     
     board.touch(self.b, (0,1))
     b2 = board.newboard(
         """
         4 4 2 2 1
         0 4 1 3 4
         0 4 0 3 4
         2 0 0 1 4
         3 4 0 4 2
         1 1 0 4 1
         """)
     self.assertEquals(self.b, b2)
     
     board.touch(self.b, (0,1))
     b2 = board.newboard(
         """
         0 0 4 2 1
         0 0 2 3 4
         0 0 0 4 4
         4 0 0 3 4
         0 0 0 0 4
         2 3 0 0 2
         """)
     self.assertEquals(self.b, b2)
     
     board.touch(self.b, (2,3))
     b2 = board.newboard(
         """
         0 0 4 4 4
         0 0 3 0 0
         0 0 0 0 0
         0 0 0 0 0
         0 0 0 0 0
         3 3 0 0 4
         """)
     self.assertEquals(self.b, b2)
Ejemplo n.º 4
0
 def setUp(self):
     self.b = board.newboard("""
         3 3 2 0 1
         2 1 2 3 3
         2 0 4 0 1
         4 1 3 4 2
         0 2 4 4 2
         2 2 4 2 2            
         """)
Ejemplo n.º 5
0
    def testTouchOn01(self):
        board.touch(self.b, (0, 1))
        b2 = board.newboard("""
            4 3 2 2 1
            0 4 1 3 4
            0 4 0 3 4
            2 0 0 1 4
            3 4 0 4 2
            1 1 0 4 1
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (0, 1))
        b2 = board.newboard("""
            4 4 2 2 1
            0 4 1 3 4
            0 4 0 3 4
            2 0 0 1 4
            3 4 0 4 2
            1 1 0 4 1
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (0, 1))
        b2 = board.newboard("""
            0 0 4 2 1
            0 0 2 3 4
            0 0 0 4 4
            4 0 0 3 4
            0 0 0 0 4
            2 3 0 0 2
            """)
        self.assertEquals(self.b, b2)

        board.touch(self.b, (2, 3))
        b2 = board.newboard("""
            0 0 4 4 4
            0 0 3 0 0
            0 0 0 0 0
            0 0 0 0 0
            0 0 0 0 0
            3 3 0 0 4
            """)
        self.assertEquals(self.b, b2)
Ejemplo n.º 6
0
 def setUp(self):
     self.b = board.newboard(
         """
         3 3 2 0 1
         2 1 2 3 3
         2 0 4 0 1
         4 1 3 4 2
         0 2 4 4 2
         2 2 4 2 2            
         """)
Ejemplo n.º 7
0
 def testTouchOn00(self):
     board.touch(self.b, (0, 0))
     b2 = board.newboard("""
         0 3 2 2 1
         0 4 1 3 4
         0 4 0 3 4
         3 0 0 1 4
         3 4 0 4 2
         1 1 0 4 1
         """)
     self.assertEquals(self.b, b2)
Ejemplo n.º 8
0
 def testTouchOn00(self):
     board.touch(self.b, (0,0))
     b2 = board.newboard(
         """
         0 3 2 2 1
         0 4 1 3 4
         0 4 0 3 4
         3 0 0 1 4
         3 4 0 4 2
         1 1 0 4 1
         """)
     self.assertEquals(self.b, b2)
Ejemplo n.º 9
0
def game(stdscr, screen, screen_panel, field_h, field_w, mine_num):
    minefield = board.newboard(field_h, field_w, mine_num)
    minefield_list = minefield.getlist()
    display = draw(minefield, 1, 2)
    screen.clear()

    key = 0
    done = False
    while not(done):
        if key == ord('q'):
            return 'menu'
        display.cursormove(key)
        stdscr.refresh()
        screen.border()
        screen_panel.bottom()
        screen.refresh()
        display.drawboard()
        key = stdscr.getch()
Ejemplo n.º 10
0
 def setUp(self):
     # game level.1.90
     self.b = board.newboard(game_1_90)
Ejemplo n.º 11
0
 def setUp(self):
     # game level.1.90
     self.b = board.newboard(game_1_90)
Ejemplo n.º 12
0
 def setUp(self):
     self.b = board.newboard(game_1_90_m4)