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
cb324901
Commit
cb324901
authored
May 28, 2024
by
sbl1996@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug seed
parent
b5d92a22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
scripts/cleanba.py
scripts/cleanba.py
+8
-3
ygoenv/ygoenv/ygopro/ygopro.h
ygoenv/ygoenv/ygopro/ygopro.h
+17
-5
No files found.
scripts/cleanba.py
View file @
cb324901
...
@@ -596,11 +596,16 @@ def main():
...
@@ -596,11 +596,16 @@ def main():
args
.
ckpt_dir
,
save_fn
,
n_saved
=
2
)
args
.
ckpt_dir
,
save_fn
,
n_saved
=
2
)
# seeding
# seeding
seed_offset
=
args
.
local_rank
args
.
seed
+=
seed_offset
random
.
seed
(
args
.
seed
)
random
.
seed
(
args
.
seed
)
seed
=
random
.
randint
(
0
,
1e8
)
seed_offset
=
args
.
local_rank
seed
+=
seed_offset
init_key
=
jax
.
random
.
PRNGKey
(
seed
-
seed_offset
)
random
.
seed
(
seed
)
args
.
real_seed
=
random
.
randint
(
0
,
1e8
)
args
.
real_seed
=
random
.
randint
(
0
,
1e8
)
init_key
=
jax
.
random
.
PRNGKey
(
args
.
seed
-
seed_offset
)
key
=
jax
.
random
.
PRNGKey
(
args
.
real_seed
)
key
=
jax
.
random
.
PRNGKey
(
args
.
real_seed
)
key
,
*
learner_keys
=
jax
.
random
.
split
(
key
,
len
(
learner_devices
)
+
1
)
key
,
*
learner_keys
=
jax
.
random
.
split
(
key
,
len
(
learner_devices
)
+
1
)
learner_keys
=
jax
.
device_put_sharded
(
learner_keys
,
devices
=
learner_devices
)
learner_keys
=
jax
.
device_put_sharded
(
learner_keys
,
devices
=
learner_devices
)
...
...
ygoenv/ygoenv/ygopro/ygopro.h
View file @
cb324901
...
@@ -1501,7 +1501,13 @@ public:
...
@@ -1501,7 +1501,13 @@ public:
if (input == "quit") {
if (input == "quit") {
exit(0);
exit(0);
}
}
int
idx
=
std
::
stoi
(
input
)
-
1
;
int idx = -1;
try {
idx = std::stoi(input) - 1;
} catch (std::invalid_argument &e) {
fmt::println("{} Invalid input: {}", duel_player_, input);
continue;
}
if (idx >= 0 && idx < actions.size()) {
if (idx >= 0 && idx < actions.size()) {
return idx;
return idx;
} else {
} else {
...
@@ -1720,6 +1726,7 @@ public:
...
@@ -1720,6 +1726,7 @@ public:
throw std::runtime_error("record mode must be used with verbose mode and num_envs=1");
throw std::runtime_error("record mode must be used with verbose mode and num_envs=1");
}
}
}
}
fmt::println("env_id: {}, seed: {}, x: {}", env_id_, seed_, dist_int_(gen_));
duel_gen_ = std::mt19937(dist_int_(gen_));
duel_gen_ = std::mt19937(dist_int_(gen_));
...
@@ -4158,10 +4165,13 @@ private:
...
@@ -4158,10 +4165,13 @@ private:
for (const auto &card : cards) {
for (const auto &card : cards) {
auto spec = card.get_spec(player);
auto spec = card.get_spec(player);
specs.push_back(spec);
specs.push_back(spec);
int i = specs.size();
if (card.controler_ != player && card.position_ & POS_FACEDOWN) {
if (card.controler_ != player && card.position_ & POS_FACEDOWN) {
pl
->
notify
(
spec
+
": "
+
card
.
get_position
()
+
" card"
);
pl->notify(
fmt::format("{}: {} card ({})", i, card.get_position(), spec));
} else {
} else {
pl
->
notify
(
spec
+
": "
+
card
.
name_
);
pl->notify(
fmt::format("{}: {} ({})", i, card.name_, spec));
}
}
}
}
} else {
} else {
...
@@ -4242,7 +4252,8 @@ private:
...
@@ -4242,7 +4252,8 @@ private:
for (const auto &card : cards) {
for (const auto &card : cards) {
auto spec = card.get_spec(player);
auto spec = card.get_spec(player);
specs.push_back(spec);
specs.push_back(spec);
pl
->
notify
(
spec
+
": "
+
card
.
name_
);
pl->notify(
fmt::format("{}: {} ({})", specs.size(), card.name_, spec));
}
}
} else {
} else {
for (int i = 0; i < size; ++i) {
for (int i = 0; i < size; ++i) {
...
@@ -4369,7 +4380,8 @@ private:
...
@@ -4369,7 +4380,8 @@ private:
for (const auto &card : select) {
for (const auto &card : select) {
auto spec = card.get_spec(player);
auto spec = card.get_spec(player);
select_specs.push_back(spec);
select_specs.push_back(spec);
pl
->
notify
(
spec
+
": "
+
card
.
name_
);
pl->notify(
fmt::format("{}: {} ({})", select_specs.size(), card.name_, spec));
}
}
} else {
} else {
for (int i = 0; i < select_size; ++i) {
for (int i = 0; i < select_size; ++i) {
...
...
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