Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygo-agent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biluo Shen
ygo-agent
Commits
0c7cfc92
Commit
0c7cfc92
authored
Feb 20, 2024
by
biluo.shen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove card of announce_card
parent
987146ea
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
assets/deck/BlueEyesMaxDragon.ydk
assets/deck/BlueEyesMaxDragon.ydk
+0
-1
scripts/dmc.py
scripts/dmc.py
+7
-7
ygoenv/ygoenv/ygopro/ygopro.h
ygoenv/ygoenv/ygopro/ygopro.h
+6
-4
No files found.
assets/deck/BlueEyesMaxDragon.ydk
View file @
0c7cfc92
...
...
@@ -48,7 +48,6 @@
65330383
38342335
2857636
28776350
75452921
3987233
3987233
...
...
scripts/dmc.py
View file @
0c7cfc92
...
...
@@ -88,6 +88,8 @@ class Args:
env_threads
:
Optional
[
int
]
=
32
"""the number of threads to use for envpool, defaults to `num_envs`"""
tb_dir
:
str
=
"./runs"
"""tensorboard log directory"""
# to be filled in runtime
num_iterations
:
int
=
0
...
...
@@ -109,7 +111,7 @@ if __name__ == "__main__":
run_name
=
f
"{args.env_id}__{args.exp_name}__{args.seed}__{timestamp}"
from
torch.utils.tensorboard
import
SummaryWriter
writer
=
SummaryWriter
(
f
"runs/{run_name}"
)
writer
=
SummaryWriter
(
os
.
path
.
join
(
args
.
tb_dir
,
run_name
)
)
writer
.
add_text
(
"hyperparameters"
,
"|param|value|
\n
|-|-|
\n
%
s"
%
(
"
\n
"
.
join
([
f
"|{key}|{value}|"
for
key
,
value
in
vars
(
args
)
.
items
()])),
...
...
@@ -164,7 +166,7 @@ if __name__ == "__main__":
avg_win_rates
=
[]
avg_ep_returns
=
[]
elo
=
Elo
()
#
elo = Elo()
selfplay
=
"self"
in
args
.
play_mode
rb
=
DMCDictBuffer
(
...
...
@@ -235,15 +237,13 @@ if __name__ == "__main__":
else
:
# win rate of agent
winner
=
0
if
episode_reward
>
0
else
1
elo
.
update
(
winner
)
writer
.
add_scalar
(
"charts/elo_rating"
,
elo
.
r0
,
global_step
)
# elo.update(winner)
else
:
avg_ep_returns
.
append
(
episode_reward
)
winner
=
0
if
episode_reward
>
0
else
1
avg_win_rates
.
append
(
1
-
winner
)
elo
.
update
(
winner
)
writer
.
add_scalar
(
"charts/elo_rating"
,
elo
.
r0
,
global_step
)
print
(
f
"global_step={global_step}, e_ret={episode_reward}, e_len={episode_length}, elo={elo.r0}"
)
# elo.update(winner)
print
(
f
"global_step={global_step}, e_ret={episode_reward}, e_len={episode_length}"
)
if
len
(
avg_win_rates
)
>
100
:
writer
.
add_scalar
(
"charts/avg_win_rate"
,
np
.
mean
(
avg_win_rates
),
global_step
)
...
...
ygoenv/ygoenv/ygopro/ygopro.h
View file @
0c7cfc92
...
...
@@ -1454,11 +1454,11 @@ public:
}
void show_deck(const std::vector<CardCode> &deck, const std::string &prefix) const {
fmt
::
print
(
"{} deck:"
,
prefix
);
for
(
auto
code
:
deck
)
{
fmt
::
print
(
"
{}"
,
c_get_card
(
code
).
name
());
fmt::print("{} deck:
[
", prefix);
for (
int i = 0; i < deck.size(); i++
) {
fmt::print("
'{}'", c_get_card(deck[i]
).name());
}
fmt
::
print
(
"
\n
"
);
fmt::print("
]
\n");
}
void show_turn() const {
...
...
@@ -3961,6 +3961,8 @@ private:
set_responsei(pduel_, 1 << pos);
};
} else {
show_deck(0);
show_deck(1);
throw std::runtime_error(
fmt::format("Unknown message {}, length {}, dp {}",
msg_to_string(msg_), dl_, dp_));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment