コード例 #1
0
ファイル: test.py プロジェクト: ktp-forked-repos/terratri
    def test_validSteps(self):
        self.assertEquals({
            'n': 'c2',
            'e': 'd1',
            'w': 'b1'
        }, terratri.validSteps('r', terratri.startGrid(), ''))

        # after an inital move of n, red changed the board, so can return south
        self.assertEquals(
            {
                'n': 'c3',
                'e': 'd2',
                'w': 'b2',
                's': 'c1',
                'x': 'end'
            }, terratri.validSteps('r', terratri.after('n'), 'n'))

        # after 1. ns:
        self.assertEquals({
            'S': 'c4',
            'E': 'd5',
            'W': 'b5'
        }, terratri.validSteps('b', terratri.after('ns'), 'ns'))

        # after 1. ns .. SN, red's choices are the same as on the first move
        self.assertEquals({
            'n': 'c2',
            'e': 'd1',
            'w': 'b1'
        }, terratri.validSteps('r', terratri.after('nsSN'), 'nsSN'))

        # but if 2. n, red cannot return south as it leaves the board unchanged
        self.assertEquals({
            'n': 'c3',
            'e': 'd2',
            'w': 'b2',
            'x': 'end'
        }, terratri.validSteps('r', terratri.after('nsSNn'), 'nsSNn'))
コード例 #2
0
ファイル: test.py プロジェクト: tangentstorm/terratri
    def test_validSteps(self):
        self.assertEquals(
            {'n':'c2', 'e':'d1', 'w':'b1'},
            terratri.validSteps('r', terratri.startGrid(), ''))

        # after an inital move of n, red changed the board, so can return south
        self.assertEquals(
            {'n':'c3', 'e':'d2', 'w':'b2', 's':'c1', 'x':'end'},
            terratri.validSteps('r', terratri.after('n'), 'n'))

        # after 1. ns:
        self.assertEquals(
            {'S':'c4', 'E':'d5', 'W':'b5'},
            terratri.validSteps('b', terratri.after('ns'), 'ns'))

        # after 1. ns .. SN, red's choices are the same as on the first move
        self.assertEquals(
            {'n':'c2', 'e':'d1', 'w':'b1'},
            terratri.validSteps('r', terratri.after('nsSN'), 'nsSN'))

        # but if 2. n, red cannot return south as it leaves the board unchanged
        self.assertEquals(
            {'n':'c3', 'e':'d2', 'w':'b2', 'x':'end'},
            terratri.validSteps('r', terratri.after('nsSNn'), 'nsSNn'))
コード例 #3
0
ファイル: test.py プロジェクト: tangentstorm/terratri
 def test_findPawn(self):
     start = terratri.startGrid()
     self.assertEquals((2, 0, False), terratri.findPawn('b', start))
     self.assertEquals((2, 4, False), terratri.findPawn('r', start))
コード例 #4
0
ファイル: test.py プロジェクト: ktp-forked-repos/terratri
 def test_findPawn(self):
     start = terratri.startGrid()
     self.assertEquals((2, 0, False), terratri.findPawn('b', start))
     self.assertEquals((2, 4, False), terratri.findPawn('r', start))