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
2d2b1ceb
Commit
2d2b1ceb
authored
Mar 03, 2024
by
sbl1996@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add edopro
parent
16fca7eb
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
811 additions
and
495 deletions
+811
-495
repo/packages/e/edopro-core/xmake.lua
repo/packages/e/edopro-core/xmake.lua
+11
-2
scripts/eval.py
scripts/eval.py
+1
-1
ygoai/utils.py
ygoai/utils.py
+5
-4
ygoenv/ygoenv/edopro/edopro.h
ygoenv/ygoenv/edopro/edopro.h
+726
-426
ygoenv/ygoenv/entry.py
ygoenv/ygoenv/entry.py
+6
-0
ygoenv/ygoenv/ygopro/ygopro.h
ygoenv/ygoenv/ygopro/ygopro.h
+62
-62
No files found.
repo/packages/e/edopro-core/xmake.lua
View file @
2d2b1ceb
package
(
"edopro-core"
)
set_homepage
(
"https://github.com/edo9300/ygopro-core"
)
--
set_homepage("https://github.com/edo9300/ygopro-core")
set_urls
(
"https://github.com/edo9300/ygopro-core.git"
)
-- set_urls("https://github.com/edo9300/ygopro-core.git")
set_sourcedir
(
path
.
join
(
os
.
scriptdir
(),
"edopro-core"
))
set_policy
(
"package.install_always"
,
true
)
add_deps
(
"lua"
)
...
...
@@ -27,6 +30,12 @@ package("edopro-core")
end
end
check_and_insert
(
"interpreter.h"
,
12
,
"extern \"
C
\
" {"
)
check_and_insert
(
"interpreter.h"
,
14
,
"}"
)
check_and_insert
(
"interpreter.h"
,
16
,
"extern \"
C
\
" {"
)
check_and_insert
(
"interpreter.h"
,
19
,
"}"
)
local
configs
=
{}
if
package
:
config
(
"shared"
)
then
configs
.
kind
=
"shared"
...
...
scripts/eval.py
View file @
2d2b1ceb
...
...
@@ -99,7 +99,7 @@ if __name__ == "__main__":
args
.
env_threads
=
min
(
args
.
env_threads
or
args
.
num_envs
,
args
.
num_envs
)
args
.
torch_threads
=
args
.
torch_threads
or
int
(
os
.
getenv
(
"OMP_NUM_THREADS"
,
"4"
))
deck
=
init_ygopro
(
args
.
lang
,
args
.
deck
,
args
.
code_list_file
)
deck
=
init_ygopro
(
args
.
env_id
,
args
.
lang
,
args
.
deck
,
args
.
code_list_file
)
args
.
deck1
=
args
.
deck1
or
deck
args
.
deck2
=
args
.
deck2
or
deck
...
...
ygoai/utils.py
View file @
2d2b1ceb
import
itertools
from
pathlib
import
Path
from
ygoenv.ygopro
import
init_module
def
load_deck
(
fn
):
with
open
(
fn
)
as
f
:
...
...
@@ -24,7 +21,7 @@ _languages = {
"chinese"
:
"zh"
,
}
def
init_ygopro
(
lang
,
deck
,
code_list_file
,
preload_tokens
=
False
):
def
init_ygopro
(
env_id
,
lang
,
deck
,
code_list_file
,
preload_tokens
=
False
):
short
=
_languages
[
lang
]
db_path
=
Path
(
get_root_directory
(),
'assets'
,
'locale'
,
short
,
'cards.cdb'
)
deck_fp
=
Path
(
deck
)
...
...
@@ -41,5 +38,9 @@ def init_ygopro(lang, deck, code_list_file, preload_tokens=False):
if
not
token_deck
.
exists
():
raise
FileNotFoundError
(
f
"Token deck not found: {token_deck}"
)
decks
[
"_tokens"
]
=
str
(
token_deck
)
if
'YGOPro'
in
env_id
:
from
ygoenv.ygopro
import
init_module
elif
'EDOPro'
in
env_id
:
from
ygoenv.edopro
import
init_module
init_module
(
str
(
db_path
),
code_list_file
,
decks
)
return
deck_name
\ No newline at end of file
ygoenv/ygoenv/edopro/edopro.h
View file @
2d2b1ceb
This diff is collapsed.
Click to expand it.
ygoenv/ygoenv/entry.py
View file @
2d2b1ceb
...
...
@@ -19,6 +19,12 @@ except ImportError:
pass
try
:
import
ygoenv.edopro.registration
# noqa: F401
except
ImportError
:
pass
try
:
import
ygoenv.dummy.registration
# noqa: F401
except
ImportError
:
...
...
ygoenv/ygoenv/ygopro/ygopro.h
View file @
2d2b1ceb
This diff is collapsed.
Click to expand it.
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