Python features.stone_features() Examples

The following are 6 code examples of features.stone_features(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module features , or try the search function .
Example #1
Source File: test_features.py    From training_results_v0.5 with Apache License 2.0 5 votes vote down vote up
def test_stone_features(self):
        f = features.stone_features(TEST_POSITION3)
        self.assertEqual(TEST_POSITION3.to_play, go.WHITE)
        self.assertEqual(f.shape, (9, 9, 16))
        self.assertEqualNPArray(f[:, :, 0], test_utils.load_board('''
            ...X.....
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 1], test_utils.load_board('''
            X.X......
            .X.......''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 2], test_utils.load_board('''
            .X.X.....
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 3], test_utils.load_board('''
            X.X......
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 4], test_utils.load_board('''
            .X.......
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 5], test_utils.load_board('''
            X.X......
            .........''' + EMPTY_ROW * 7))

        for i in range(10, 16):
            self.assertEqualNPArray(f[:, :, i], np.zeros([go.N, go.N])) 
Example #2
Source File: test_features.py    From training_results_v0.5 with Apache License 2.0 5 votes vote down vote up
def test_stone_features(self):
        f = features.stone_features(TEST_POSITION3)
        self.assertEqual(TEST_POSITION3.to_play, go.WHITE)
        self.assertEqual(f.shape, (9, 9, 16))
        self.assertEqualNPArray(f[:, :, 0], test_utils.load_board('''
            ...X.....
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 1], test_utils.load_board('''
            X.X......
            .X.......''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 2], test_utils.load_board('''
            .X.X.....
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 3], test_utils.load_board('''
            X.X......
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 4], test_utils.load_board('''
            .X.......
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 5], test_utils.load_board('''
            X.X......
            .........''' + EMPTY_ROW * 7))

        for i in range(10, 16):
            self.assertEqualNPArray(f[:, :, i], np.zeros([go.N, go.N])) 
Example #3
Source File: features_test.py    From Gun-Detector with Apache License 2.0 5 votes vote down vote up
def test_stone_features(self):
    f = features.stone_features(utils_test.BOARD_SIZE, TEST_POSITION3)
    self.assertEqual(TEST_POSITION3.to_play, go.WHITE)
    self.assertEqual(f.shape, (9, 9, 16))
    self.assertEqualNPArray(f[:, :, 0], utils_test.load_board('''
      ...X.....
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 1], utils_test.load_board('''
      X.X......
      .X.......''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 2], utils_test.load_board('''
      .X.X.....
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 3], utils_test.load_board('''
      X.X......
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 4], utils_test.load_board('''
      .X.......
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 5], utils_test.load_board('''
      X.X......
      .........''' + EMPTY_ROW * 7))

    for i in range(10, 16):
      self.assertEqualNPArray(
          f[:, :, i], np.zeros([utils_test.BOARD_SIZE, utils_test.BOARD_SIZE])) 
Example #4
Source File: test_features.py    From training with Apache License 2.0 5 votes vote down vote up
def test_stone_features(self):
        f = features.stone_features(TEST_POSITION3)
        self.assertEqual(go.WHITE, TEST_POSITION3.to_play)
        self.assertEqual((9, 9, 16), f.shape)
        self.assertEqualNPArray(f[:, :, 0], test_utils.load_board('''
            ...X.....
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 1], test_utils.load_board('''
            X.X......
            .X.......''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 2], test_utils.load_board('''
            .X.X.....
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 3], test_utils.load_board('''
            X.X......
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 4], test_utils.load_board('''
            .X.......
            .........''' + EMPTY_ROW * 7))

        self.assertEqualNPArray(f[:, :, 5], test_utils.load_board('''
            X.X......
            .........''' + EMPTY_ROW * 7))

        all_zeros = np.zeros([go.N, go.N])
        for i in range(10, 16):
            self.assertEqualNPArray(all_zeros, f[:, :, i]) 
Example #5
Source File: features_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_stone_features(self):
    f = features.stone_features(utils_test.BOARD_SIZE, TEST_POSITION3)
    self.assertEqual(TEST_POSITION3.to_play, go.WHITE)
    self.assertEqual(f.shape, (9, 9, 16))
    self.assertEqualNPArray(f[:, :, 0], utils_test.load_board('''
      ...X.....
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 1], utils_test.load_board('''
      X.X......
      .X.......''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 2], utils_test.load_board('''
      .X.X.....
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 3], utils_test.load_board('''
      X.X......
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 4], utils_test.load_board('''
      .X.......
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 5], utils_test.load_board('''
      X.X......
      .........''' + EMPTY_ROW * 7))

    for i in range(10, 16):
      self.assertEqualNPArray(
          f[:, :, i], np.zeros([utils_test.BOARD_SIZE, utils_test.BOARD_SIZE])) 
Example #6
Source File: features_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_stone_features(self):
    f = features.stone_features(utils_test.BOARD_SIZE, TEST_POSITION3)
    self.assertEqual(TEST_POSITION3.to_play, go.WHITE)
    self.assertEqual(f.shape, (9, 9, 16))
    self.assertEqualNPArray(f[:, :, 0], utils_test.load_board('''
      ...X.....
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 1], utils_test.load_board('''
      X.X......
      .X.......''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 2], utils_test.load_board('''
      .X.X.....
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 3], utils_test.load_board('''
      X.X......
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 4], utils_test.load_board('''
      .X.......
      .........''' + EMPTY_ROW * 7))

    self.assertEqualNPArray(f[:, :, 5], utils_test.load_board('''
      X.X......
      .........''' + EMPTY_ROW * 7))

    for i in range(10, 16):
      self.assertEqualNPArray(
          f[:, :, i], np.zeros([utils_test.BOARD_SIZE, utils_test.BOARD_SIZE]))