[Commits] [wesnoth/wesnoth] 1b3eec: Split the combat_matrix class to two

GitHub noreply at github.com
Mon Aug 1 10:06:15 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 1b3eecf8df55e253d1eeb1c274ba5487194fbaa6
      https://github.com/wesnoth/wesnoth/commit/1b3eecf8df55e253d1eeb1c274ba5487194fbaa6
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Split the combat_matrix class to two

Combat_matrix is now an abstract class, and a new class called
probability_combat_matrix got the functionality split away from
combat_matrix.

I plan to later create a class called monte_carlo_combat_matrix. This way
the Monte Carlo combat simulation code can inherit functionality it needs
(combat_matrix) but not the functionality it doesn't
(probability_combat_matrix). In addition, the calling code can use both
classes through the shared interface.


  Commit: 93761bcd1e67f13b4de09779338cb1c807e914f9
      https://github.com/wesnoth/wesnoth/commit/93761bcd1e67f13b4de09779338cb1c807e914f9
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp
    M src/attack_prediction.hpp
    M src/random_new.cpp
    M src/random_new.hpp

  Log Message:
  -----------
  Initial implementation of the Monte Carlo damage prediction mode

The implementation isn't yet wired to the high-level damage preview
calculation code, or even tested for that matter.

I also extended the random number generator by adding functions
get_random_bool(), get_random_float() and get_random_element().


  Commit: cbbc665c45261fcc19d8026a9ec3835f26ffe489
      https://github.com/wesnoth/wesnoth/commit/cbbc665c45261fcc19d8026a9ec3835f26ffe489
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Minor bug fixes and code quality improvements


  Commit: 2c04802a7daecec106bd4807aa336e4023ca69ac
      https://github.com/wesnoth/wesnoth/commit/2c04802a7daecec106bd4807aa336e4023ca69ac
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp
    M src/attack_prediction.hpp

  Log Message:
  -----------
  Use Monte Carlo damage calculation in very complex fights


  Commit: ddf842194446917847203c8e3afa0d04f24b50a2
      https://github.com/wesnoth/wesnoth/commit/ddf842194446917847203c8e3afa0d04f24b50a2
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Various improvements

* Use the C++11 std::chrono functionality for damage prediction code
  benchmarking. This way the stand-alone testing/benchmarking code can be
  compiled on any platform.
* Implement calculating the probability to be hit.
* Fix: prob_matrix::clear() didn't fully clear the matrix.


  Commit: c43f70418fe442b6a9eb5790d9eca011aea7aa78
      https://github.com/wesnoth/wesnoth/commit/c43f70418fe442b6a9eb5790d9eca011aea7aa78
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Fix operator precedence issue

The fight_complexity() function was returning way too low values.


  Commit: d83e0176899cd935befae000cfae9f7deb23b55f
      https://github.com/wesnoth/wesnoth/commit/d83e0176899cd935befae000cfae9f7deb23b55f
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Remove a performance optimization

The attack prediction code used to skip creating the "A slowed" or
"B slowed" plane if A or B was already slowed. As a result, after the
battle the "summary" array of the combatant had a different meaning from
usual: normally summary[0] means the HP distribution when the combatant is
not slowed, and summary[1] means the HP distribution when the combatant is
slowed. However, if the combatant was already slowed before the battle,
summary[0] was the HP distribution when the combatant is slowed and
summary[1] was empty.

This optimization didn't break anything, thanks to itself: because the
"A slowed" or "B slowed" plane wasn't used, the code fetched the
HP distribution from summary[0] instead of summary[1] and therefore
obtained the correct distribution.

However, my Monte Carlo simulation code requires that summary[0] and
summary[1] have their usual meanings. I decided that the optimization is
too hard to support, and removed it.


  Commit: 6766e05747947157f583584112c2fff733671180
      https://github.com/wesnoth/wesnoth/commit/6766e05747947157f583584112c2fff733671180
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M changelog
    M data/advanced_preferences.cfg
    M players_changelog
    M src/attack_prediction.cpp
    M src/preferences.cpp
    M src/preferences.hpp

  Log Message:
  -----------
  Put the Monte Carlo mode behind an advanced preference and update changelog


  Commit: 9e10291df5b34eb858cd07fdaf22886aa4a4a70f
      https://github.com/wesnoth/wesnoth/commit/9e10291df5b34eb858cd07fdaf22886aa4a4a70f
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Attempted fix for build failure with -Werror=reorder


  Commit: 1bf58b83f425a44123d2bf9b925c1f42063952a7
      https://github.com/wesnoth/wesnoth/commit/1bf58b83f425a44123d2bf9b925c1f42063952a7
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M src/random_new.hpp

  Log Message:
  -----------
  Fixed build with GCC and Clang


  Commit: 0e7305017e3649f460febe867e9610930721d900
      https://github.com/wesnoth/wesnoth/commit/0e7305017e3649f460febe867e9610930721d900
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M changelog
    M data/advanced_preferences.cfg
    M players_changelog
    M src/preferences.cpp

  Log Message:
  -----------
  Enabled Monte Carlo simulation mode by default


  Commit: 2360fb626098b3ee5495af0b0dcf2db6bf92eec6
      https://github.com/wesnoth/wesnoth/commit/2360fb626098b3ee5495af0b0dcf2db6bf92eec6
  Author: Andreas Löf <andreas at alternating.net>
  Date:   2016-08-01 (Mon, 01 Aug 2016)

  Changed paths:
    M changelog
    M data/advanced_preferences.cfg
    M players_changelog
    M src/attack_prediction.cpp
    M src/attack_prediction.hpp
    M src/preferences.cpp
    M src/preferences.hpp
    M src/random_new.cpp
    M src/random_new.hpp

  Log Message:
  -----------
  Merge branch 'monte-carlo-damage-calculation' of https://github.com/jyrkive/wesnoth into jyrkive-monte-carlo-damage-calculation


  Commit: 094250c27c6934fe3f43b91ee2f8a8e330a1bc16
      https://github.com/wesnoth/wesnoth/commit/094250c27c6934fe3f43b91ee2f8a8e330a1bc16
  Author: Andreas Löf <andreas at alternating.net>
  Date:   2016-08-01 (Mon, 01 Aug 2016)

  Changed paths:
    M changelog
    M data/advanced_preferences.cfg
    M players_changelog
    M src/attack_prediction.cpp
    M src/attack_prediction.hpp
    M src/preferences.cpp
    M src/preferences.hpp
    M src/random_new.cpp
    M src/random_new.hpp

  Log Message:
  -----------
  Merge branch 'jyrkive-monte-carlo-damage-calculation'


Compare: https://github.com/wesnoth/wesnoth/compare/6080cfb969f6...094250c27c69


More information about the Commits mailing list