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

"Getter" for payoff_arrays #68

Open
oyamad opened this issue Jan 8, 2018 · 0 comments
Open

"Getter" for payoff_arrays #68

oyamad opened this issue Jan 8, 2018 · 0 comments
Labels

Comments

@oyamad
Copy link
Member

oyamad commented Jan 8, 2018

What is the proper Julia counterpart of QuantEcon/QuantEcon.py#382?

  1. Add a field payoff_arrays to NormalFormGame:

    struct NormalFormGame{N,T<:Real}
        players::NTuple{N,Player{N,T}}
        nums_actions::NTuple{N,Int}
        payoff_arrays::NTuple{N,Array{T,N}}
    end

    This seems not to be very Julian?
    And this requires adding the same code of generating the tuple to many constructors.

  2. Add a method payoff_arrays to NormalFormGame:

    payoff_arrays(g::NormalFormGame{N,T}) where {N,T} =
        tuple([player.payoff_array for player in g.players]...)::NTuple{N,Array{T,N}}

    This is what I had in mind initially, but now I want to avoid this as it will introduce a conflict with the likely usage of payoff_arrays as a variable name.

  3. Name the above method get_payoff_arrays:

    Sounds too long? And to "get" payoff arrays, one could just call g.players[i].payoff_array.

@oyamad oyamad added the question label Jan 9, 2018
@oyamad oyamad added discuss and removed question labels Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant