fcarsten / tic-tac-toe

Teaching a machine to play tic-tac-toe
Apache License 2.0
55 stars 37 forks source link

Fix return types #6

Open tarobins opened 8 months ago

tarobins commented 8 months ago
  1. Fix error such as "Tuple expression not allowed in type annotation Use tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union typePylancereportInvalidTypeForm"

  2. Fix return type of _min and _max on RndMinMaxAgent, both of which return a tuple

fcarsten commented 8 months ago

Thanks for your pull request. Happy to merge in principal, but I think some of them are not quite correct at the moment. E.g. I think get_probs() and get_valid_probs() in should return tuple[list[float], list[float]] rather than tuple[float, float] in DirectPolicyAngent, EGreedyNNQPlayer, and ExpDoubleDuelQPlayer. Can you have a look and fix where necessary?

tarobins commented 8 months ago

Will do. May take a day or two. I also hope to send you PRs to update the code to use v2 api.

On Tue, Feb 20, 2024 at 3:25 PM Carsten Friedrich @.***> wrote:

Thanks for your pull request. Happy to merge in principal, but I think some of them are not quite correct at the moment. E.g. I think get_probs() and get_valid_probs() in should return tuple[list[float], list[float]] rather than tuple[float, float] in DirectPolicyAngent, EGreedyNNQPlayer, and ExpDoubleDuelQPlayer. Can you have a look and fix where necessary?

— Reply to this email directly, view it on GitHub https://github.com/fcarsten/tic-tac-toe/pull/6#issuecomment-1955327594, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFFHOOTLYZEL2XQRVLOAHTYUUWH5AVCNFSM6AAAAABDOUGABKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJVGMZDONJZGQ . You are receiving this because you authored the thread.Message ID: @.***>

tarobins commented 7 months ago

Fixed, I think

fcarsten commented 7 months ago

get_probs() and get_valid_probs() in DeepExpDoubleDuelQPlayer still look incorrect. Rest looks good!

fcarsten commented 7 months ago

Also wondering if the correct type in get_probs() and get_valid_probs() across all classes is actually tuple[NDArray[float], NDArray[float]] rather than tuple[list[float], list[float]]