summaryrefslogtreecommitdiff
path: root/sim.cpp
AgeCommit message (Collapse)Author
2023-07-19Fix integer size compiler warnings.John Fultz
2023-07-17Fix up std:: namespace hygiene.John Fultz
* Remove all uses of `using namespace std` from header files (although a few specific cases of things like `using std::vector` remain) * Move all existing uses of `using namespace std` in cpp files to after the header includes * Make coordinating changes so it builds again. Qt6 builds on Windows were breaking because of namespace collision between std::byte and some version of `byte` in one of Qt's namespaces. That breakage is now fixed. It would be good to systematically clean up all `using` declarations in header files to ensure nothing is leaking out, but that's for another time.
2020-06-18A few miscellaneous typo fixesOliver Galvin
2019-08-06Fix regression in simulator.John Fultz
When I refactored the simming loop in Simulator::simulateOnePosition() using a ranged for, I mis-translated the value of the playerNumber variable. This resulted in the results of some plays being double-weighted. This fixes a bug where a 2-ply sim on the opening rack ACINPU? will favor non-bingo plays like UP or CUP rather than bingo plays like PANICUm or PUrANIC. The Championship Player uses a 2-ply sim, so the Championship Player could make some bone-headed plays with this regression.
2019-07-27Accommodate spurious wakeup of condition variables.John Fultz
Hopefully, this fixes crashes some users are seeing.
2019-07-21Sims are now threaded.John Fultz
Defaults to two threads right now. This can be changed in the Simulator constructor for the time being. An interface will be added for this soon. For an example I tried, I got the following times on 500 simulations in a macOS release build: * Quackle 1.0.3 - 26 seconds * master branch, 1 thread - 27 seconds * master branch, 2 threads - 19 seconds * master branch, 4 threads - 15 seconds This isn't the most efficient use of threads. It distributes all of the plays being simmed into a thread pool, but only for one simulation. Then it comes up for air and tries again. This was the easiest to implement robustly given the current architecture.
2019-07-21Move simulate code to a new static function.John Fultz
The code running the simulation is now disconnected from the Simulation class, with appropriate members being copied into a SimmedMoveConstants field (read-only, thread-safe) and a SimmedMoveMessage (the class for communicating per-sim data to and from external threads). The newly added static function, Simulate::simulateOnePosition(), should now be thread-safe and usable as a run function for a thread.
2019-07-21Rework the simulation messaging.John Fultz
Break out things that are effectively constant into a separate struct so we don't have to keep initializing them. Also, ensure that all of the things I forgot are abstracted so I can break out the per-move simulation into a different function.
2019-07-21Migrate more stuff into sim messages.John Fultz
2019-07-21Move sim toward a message passing model.John Fultz
In prep for allowing sims to be handed off to a thread pool.
2019-02-04After discussion with Jason/John, add myself as a copyright holder.John Fultz
Also, extend copyright to 2019.
2019-01-07Use range-based for iterators in sim code.John Fultz
Also, while reading through this, found one bug where a vector was being rearranged via erase/insert while an iterator was still pointing to the element being erased.
2016-07-07Increment version number and copyright date.John Fultz
Also, fix a typo and remove dead code.
2015-07-21Visual Studio build maintenance.John Fultz
* Fix compiler warnings * Add Visual Studio 2013 solution * Tweak .pro files * Most importantly, rename main 'quackle' project to 'libquackle' to avoid solution-level name conflict. This only affects the VS build.
2014-09-02Change GPL file headers to v3.John Fultz
Not a very interesting commit...only changes in comments.
2013-08-25Initial git commit.Jason Katz-Brown