-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .connect_four import ConnectFour | ||
from .go import Go9x9, Go19x19 | ||
from .tic_tac_toe import TicTacToe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pgx | ||
from chex import dataclass | ||
|
||
from dopamax.environments.pgx.base import PGXEnvironment | ||
from dopamax.environments.utils import register | ||
|
||
_NAME = "Chess" | ||
|
||
|
||
@register(_NAME) | ||
@dataclass(frozen=True) | ||
class Chess(PGXEnvironment): | ||
def __init__(self): | ||
pgx_env = pgx.make("chess") | ||
super(Chess, self).__init__(_pgx_env=pgx_env) | ||
|
||
@property | ||
def max_episode_length(self) -> int: | ||
return 512 # From AlphaZero paper | ||
|
||
@property | ||
def name(self) -> str: | ||
return _NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pgx | ||
from chex import dataclass | ||
|
||
from dopamax.environments.pgx.base import PGXEnvironment | ||
from dopamax.environments.utils import register | ||
|
||
_NAME_9x9 = "Go9x9" | ||
_NAME_19x19 = "Go19x19" | ||
|
||
|
||
@register(_NAME_9x9) | ||
@dataclass(frozen=True) | ||
class Go9x9(PGXEnvironment): | ||
def __init__(self): | ||
pgx_env = pgx.make("go_9x9") | ||
super(Go9x9, self).__init__(_pgx_env=pgx_env) | ||
|
||
@property | ||
def max_episode_length(self) -> int: | ||
return 9 * 9 * 2 | ||
|
||
@property | ||
def name(self) -> str: | ||
return _NAME_9x9 | ||
|
||
|
||
@register(_NAME_19x19) | ||
@dataclass(frozen=True) | ||
class Go19x19(PGXEnvironment): | ||
def __init__(self): | ||
pgx_env = pgx.make("go_19x19") | ||
super(Go19x19, self).__init__(_pgx_env=pgx_env) | ||
|
||
@property | ||
def max_episode_length(self) -> int: | ||
return 19 * 19 * 2 | ||
|
||
@property | ||
def name(self) -> str: | ||
return _NAME_19x19 |