當前位置: 首頁>>代碼示例>>Python>>正文


Python gtp.PASS屬性代碼示例

本文整理匯總了Python中gtp.PASS屬性的典型用法代碼示例。如果您正苦於以下問題:Python gtp.PASS屬性的具體用法?Python gtp.PASS怎麽用?Python gtp.PASS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在gtp的用法示例。


在下文中一共展示了gtp.PASS屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: from_pygtp

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def from_pygtp(pygtpc):
    """Converts from a pygtp coordinate to a MiniGo coordinate."""
    # GTP has a notion of both a Pass and a Resign, both of which are mapped to
    # None, so the conversion is not precisely bijective.
    if pygtpc in (gtp.PASS, gtp.RESIGN):
        return None
    return go.N - pygtpc[1], pygtpc[0] - 1 
開發者ID:mlperf,項目名稱:training_results_v0.5,代碼行數:9,代碼來源:coords.py

示例2: to_pygtp

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def to_pygtp(coord):
    """Converts from a MiniGo coordinate to a pygtp coordinate."""
    if coord is None:
        return gtp.PASS
    return coord[1] + 1, go.N - coord[0] 
開發者ID:mlperf,項目名稱:training_results_v0.5,代碼行數:7,代碼來源:coords.py

示例3: parse_pygtp_coords

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def parse_pygtp_coords(vertex):
    'Interprets coords. (1, 1) is bottom left; (1, 9) is top left.'
    if vertex in (gtp.PASS, gtp.RESIGN):
        return None
    return go.N - vertex[1], vertex[0] - 1 
開發者ID:llSourcell,項目名稱:alphago_demo,代碼行數:7,代碼來源:utils.py

示例4: unparse_pygtp_coords

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def unparse_pygtp_coords(c):
    if c is None:
        return gtp.PASS
    return c[1] + 1, go.N - c[0] 
開發者ID:llSourcell,項目名稱:alphago_demo,代碼行數:6,代碼來源:utils.py

示例5: get_move

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def get_move(self, color):
        self.accomodate_out_of_turn(color)
        if self.should_resign(self.position):
            return gtp.RESIGN

        if self.should_pass(self.position):
            return gtp.PASS

        move = self.suggest_move(self.position)
        return utils.unparse_pygtp_coords(move) 
開發者ID:llSourcell,項目名稱:alphago_demo,代碼行數:12,代碼來源:gtp_wrapper.py

示例6: from_pygtp

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def from_pygtp(board_size, pygtpc):
  """Converts from a pygtp coordinate to a MiniGo coordinate."""
  # GTP has a notion of both a Pass and a Resign, both of which are mapped to
  # None, so the conversion is not precisely bijective.
  if pygtpc in (gtp.PASS, gtp.RESIGN):
    return None
  return board_size - pygtpc[1], pygtpc[0] - 1 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:9,代碼來源:coords.py

示例7: to_pygtp

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def to_pygtp(board_size, coord):
  """Converts from a MiniGo coordinate to a pygtp coordinate."""
  if coord is None:
    return gtp.PASS
  return coord[1] + 1, board_size - coord[0] 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:7,代碼來源:coords.py

示例8: from_pygtp

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def from_pygtp(pygtpc):
    """Converts from a pygtp coordinate to a AlphaGoZero coordinate."""
    # GTP has a notion of both a Pass and a Resign, both of which are mapped to
    # None, so the conversion is not precisely bijective.
    if pygtpc in (gtp.PASS, gtp.RESIGN):
        return None
    return GOPARAMETERS.N - pygtpc[1], pygtpc[0] - 1 
開發者ID:PacktPublishing,項目名稱:Python-Reinforcement-Learning-Projects,代碼行數:9,代碼來源:utils.py

示例9: to_pygtp

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def to_pygtp(coord):
    """Converts from a AlphaGoZero coordinate to a pygtp coordinate."""
    if coord is None:
        return gtp.PASS
    return coord[1] + 1, GOPARAMETERS.N - coord[0] 
開發者ID:PacktPublishing,項目名稱:Python-Reinforcement-Learning-Projects,代碼行數:7,代碼來源:utils.py

示例10: test_parse_move

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def test_parse_move(self):
        self.assertEqual(parse_move("B D4"), (BLACK, (4, 4)))
        self.assertFalse(parse_move("C X"))
        self.assertFalse(parse_move("B 55"))
        self.assertFalse(parse_move("B dd"))
        self.assertFalse(parse_move("B X"))
        self.assertFalse(parse_move("B"))
        self.assertEqual(parse_move("WHITE q16 XXX"), (WHITE, (16, 16)))
        self.assertEqual(parse_move("black pass"), (BLACK, PASS)) 
開發者ID:jtauber,項目名稱:gtp,代碼行數:11,代碼來源:test.py

示例11: test_gtp_vertex

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def test_gtp_vertex(self):
        self.assertEqual(gtp_vertex((4, 4)), "D4")
        self.assertEqual(gtp_vertex((16, 16)), "Q16")
        self.assertEqual(gtp_vertex(PASS), "pass")
        self.assertEqual(gtp_vertex(RESIGN), "resign") 
開發者ID:jtauber,項目名稱:gtp,代碼行數:7,代碼來源:test.py

示例12: unparse_pygtp_coords

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def unparse_pygtp_coords(c):
    if c == gtp.RESIGN:
        return gtp.RESIGN
    if c is None:
        return gtp.PASS
    return c[1] + 1, go.N - c[0] 
開發者ID:brilee,項目名稱:MuGo,代碼行數:8,代碼來源:utils.py

示例13: make_move

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def make_move(self, color, vertex):
        # vertex in GTP language is 1-indexed, whereas GameState's are zero-indexed
        try:
            if vertex == gtp.PASS:
                self._state.do_move(go.PASS_MOVE)
            else:
                (x, y) = vertex
                self._state.do_move((x - 1, y - 1), color)
            return True
        except go.IllegalMove:
            return False 
開發者ID:yhyu13,項目名稱:AlphaGOZero-python-tensorflow,代碼行數:13,代碼來源:gtp_wrapper.py

示例14: get_move

# 需要導入模塊: import gtp [as 別名]
# 或者: from gtp import PASS [as 別名]
def get_move(self, color):
        self._state.current_player = color
        move = self._player.get_move(self._state)
        if move == go.PASS_MOVE:
            return gtp.PASS
        else:
            (x, y) = move
            return (x + 1, y + 1) 
開發者ID:yhyu13,項目名稱:AlphaGOZero-python-tensorflow,代碼行數:10,代碼來源:gtp_wrapper.py


注:本文中的gtp.PASS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。