danzel / PatchworkSim

Simulation of the board game Patchwork for AI exploration
2 stars 0 forks source link

Minimax runtime performance #31

Closed danzel closed 6 years ago

danzel commented 6 years ago

Makes lots of SimulationStates without pooling.

Should do alpha beta pruning. https://en.wikipedia.org/wiki/Alpha%E2%80%93beta_pruning Or Negamax https://en.wikipedia.org/wiki/Negamax Or PVS / NegaScout https://en.wikipedia.org/wiki/Principal_variation_search

When we do, probably change to consider advancing last?

danzel commented 6 years ago

Running the profiler after doing this fix gives interesting results:

AlphaBeta 11, 24 runs: image

Should be able to optimize these all.

danzel commented 6 years ago

Dealt with Move ActivePlayer in 42ef01e495a262ff71f9f0e95b57490587422aef

danzel commented 6 years ago

TODO: Use in parameter for passing the PiecesCollection in to AI

danzel commented 6 years ago

Did more optimising in 585b3c41d8a6e158fc6278c0c700e03c9a4318dd which needs proper testing to verify it still gives the same results.

danzel commented 6 years ago

Results are still the same and perf is 5x what it was in 7604af1ad8547a06188e090f2a61e61da120554f. Even other AI run faster :)

danzel commented 6 years ago

Probably need to look at making EstimateEndGameValue smarter next.

danzel commented 6 years ago

I think this is about as fast as it is gonna get