Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Go] Tidy#1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sotetsuk merged 16 commits intomainfromsotetsuk/tidy-go-state
Dec 28, 2023
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
.
  • Loading branch information
@sotetsuk
sotetsuk committedDec 28, 2023
commit3f54878e661af8965e6f02d606c3d3ab030adbb8
8 changes: 4 additions & 4 deletionspgx/_src/games/go.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,8 +56,8 @@ def step(self, x: GameState, action: Array) -> GameState:
# update state
x = jax.lax.cond(
(action < self.size * self.size),
lambda:_not_pass_move(x, action, self.size),
lambda:_pass_move(x),
lambda:_apply_action(x, action, self.size),
lambda:_apply_pass(x),
)
# increment turns
x = x._replace(color=(x.color + 1) % 2)
Expand DownExpand Up@@ -130,11 +130,11 @@ def terminal_values(self, x: GameState):
return reward_bw


def_pass_move(state: GameState) -> GameState:
def_apply_pass(state: GameState) -> GameState:
return state._replace(consecutive_pass_count=state.consecutive_pass_count + 1)


def_not_pass_move(state: GameState, action, size) -> GameState:
def_apply_action(state: GameState, action, size) -> GameState:
state = state._replace(consecutive_pass_count=jnp.int32(0))
xy = action
num_captured_stones_before = state.num_captured_stones[state.color]
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp