Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompatHelper: bump compat for "CxxWrap" to "0.15" #23

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-24.04",
"features": {
"ghcr.io/julialang/devcontainer-features/julia": "1.10"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.fontFamily": "monospace",
"julia.environmentPath": "."
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
],
}
7 changes: 4 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name = "OpenSpiel"
uuid = "ceb70bd2-fe3f-44f0-b81f-41608acaf2f2"
authors = ["Jun Tian <[email protected]>"]
version = "0.2.4"
version = "0.3.0"

[deps]
CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4"
OpenSpiel_jll = "bd10a763-4654-5023-a028-c4918c6cd33e"

[compat]
CxxWrap = "0.14"
OpenSpiel_jll = "1.5"
CxxWrap = "0.16"
OpenSpiel_jll = "1.5.1"
StatsBase = "0.34"
julia = "1.6"

[extras]
Expand Down
35 changes: 17 additions & 18 deletions src/patch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,25 @@ end

function load_game(s::Union{String, CxxWrap.StdLib.StdStringAllocated}; kw...)
if length(kw) == 0
_load_game(s)
_load_game(s)[]
else
ps = [StdString(string(k)) => v for (k,v) in kw]
_load_game(s, StdMap{StdString, GameParameter}(ps))
_load_game(s, StdMap{StdString, GameParameter}(ps))[]
end
end

function load_game_as_turn_based(s::Union{String, CxxWrap.StdLib.StdStringAllocated}; kw...)
if length(kw) == 0
_load_game_as_turn_based(s)
_load_game_as_turn_based(s)[]
else
ps = [StdString(string(k)) => v for (k,v) in kw]
_load_game_as_turn_based(s, StdMap{StdString, GameParameter}(ps))
_load_game_as_turn_based(s, StdMap{StdString, GameParameter}(ps))[]
end
end

is_chance_node(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = is_chance_node(state[])

new_initial_state(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = new_initial_state(game[])

new_initial_state(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = new_initial_state(game[][])
legal_actions(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = legal_actions(state[])

child(state::CxxWrap.StdLib.UniquePtrAllocated{State}, i::Int64) = child(state[], i)
Expand All @@ -92,15 +91,15 @@ information_state_string(state::CxxWrap.StdLib.UniquePtrAllocated{State}, i) = i

information_state_tensor(state::CxxWrap.StdLib.UniquePtrAllocated{State}, i::Int64) = information_state_tensor(state[], i)

information_state_tensor_shape(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = information_state_tensor_shape(game[])
information_state_tensor_shape(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = information_state_tensor_shape(game[][])

get_uniform_policy(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = get_uniform_policy(game[])
get_uniform_policy(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = get_uniform_policy(game[][])

record_batched_trajectories(game::CxxWrap.StdLib.SharedPtrAllocated{Game}, p::CxxWrap.StdLib.StdVectorAllocated{TabularPolicy}, m::StdMapAllocated{StdString, Int32}, i::Int64, b::Bool, i2::Int64, i3::Int64) = record_batched_trajectories(game[], p, m, i, b, i2, i3)
record_batched_trajectories(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}, p::CxxWrap.StdLib.StdVectorAllocated{TabularPolicy}, m::StdMapAllocated{StdString, Int32}, i::Int64, b::Bool, i2::Int64, i3::Int64) = record_batched_trajectories(game[][], p, m, i, b, i2, i3)

expected_returns(state::CxxWrap.StdLib.UniquePtrAllocated{State}, policy::CxxWrap.StdLib.SharedPtrAllocated{Policy}, i::Int64) = expected_returns(state[], policy[], i)

exploitability(game::CxxWrap.StdLib.SharedPtrAllocated{Game}, policy::CxxWrap.StdLib.SharedPtrAllocated{Policy}) = exploitability(game[], policy[])
exploitability(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}, policy::CxxWrap.StdLib.SharedPtrAllocated{Policy}) = exploitability(game[][], policy[])

current_player(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = current_player(state[])

Expand Down Expand Up @@ -128,11 +127,11 @@ chance_outcomes(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = chance_outcom

returns(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = returns(state[])

min_utility(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = min_utility(game[])
min_utility(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = min_utility(game[][])

max_utility(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = max_utility(game[])
max_utility(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = max_utility(game[][])

serialize_game_and_state(game::CxxWrap.StdLib.SharedPtrAllocated{Game}, state::CxxWrap.StdLib.UniquePtrAllocated{State}) = serialize_game_and_state(game[], state[])
serialize_game_and_state(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}, state::CxxWrap.StdLib.UniquePtrAllocated{State}) = serialize_game_and_state(game[][], state[])

is_mean_field_node(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = is_mean_field_node(state[])

Expand All @@ -142,16 +141,16 @@ history(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = history(state[])

is_player_node(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = is_player_node(state[])

num_players(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = num_players(game[])
num_players(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = num_players(game[][])

distribution_support(state::CxxWrap.StdLib.UniquePtrAllocated{State}) = distribution_support(state[])

get_type(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = get_type(game[])
get_type(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = get_type(game[][])

update_distribution(state::CxxWrap.StdLib.UniquePtrAllocated{State}, dist::CxxWrap.StdLib.StdVectorAllocated{Float64}) = update_distribution(state[], dist)

num_cols(game::CxxWrap.StdLib.SharedPtrAllocated{MatrixGame}) = num_cols(game[])
num_cols(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{MatrixGame}}) = num_cols(game[][])

num_rows(game::CxxWrap.StdLib.SharedPtrAllocated{MatrixGame}) = num_rows(game[])
num_rows(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{MatrixGame}}) = num_rows(game[][])

extensive_to_matrix_game(game::CxxWrap.StdLib.SharedPtrAllocated{Game}) = extensive_to_matrix_game(game[])
extensive_to_matrix_game(game::CxxWrap.StdLib.SharedPtrAllocated{CxxWrap.CxxWrapCore.CxxConst{Game}}) = extensive_to_matrix_game(game[][])
Loading