[wesnoth-commits] [wesnoth/wesnoth] 972ecc: AI helper: improve efficiency of get_unit function...

GitHub noreply at github.com
Thu Jun 7 13:45:54 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 972ecc2f56c3cc1391db165518324b1a3757431d
      https://github.com/wesnoth/wesnoth/commit/972ecc2f56c3cc1391db165518324b1a3757431d
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2018-06-07 (Thu, 07 Jun 2018)

  Changed paths:
    M data/ai/lua/ai_helper.lua

  Log Message:
  -----------
  AI helper: improve efficiency of get_unit functions

The old method is very slightly faster in some circumstances (e.g. for
simple filters and when all units have moves/attacks/etc. left), but we
are talking fractions of micro seconds. By contrast, depending on the
filter used, the new method can save large amounts of evaluation time
once some units have move or attacked.


  Commit: 0dcbe1d0d0b1dda90a0fa649120348b7542f2644
      https://github.com/wesnoth/wesnoth/commit/0dcbe1d0d0b1dda90a0fa649120348b7542f2644
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2018-06-07 (Thu, 07 Jun 2018)

  Changed paths:
    M data/ai/micro_ais/cas/ca_goto.lua

  Log Message:
  -----------
  Goto Micro AI: change order of SLF and SUF evaluation

This is for efficiency reasons, as location filters do not necessarily
change throughout a side’s turn, while fewer and fewer units have moves
left.


  Commit: 6c38b8ce934ea68bd11a3aa960a91fe6f9dbfb87
      https://github.com/wesnoth/wesnoth/commit/6c38b8ce934ea68bd11a3aa960a91fe6f9dbfb87
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2018-06-07 (Thu, 07 Jun 2018)

  Changed paths:
    M data/ai/micro_ais/cas/ca_goto.lua

  Log Message:
  -----------
  Goto Micro AI: add [and] to a filter

Another efficiency improvement.  This ensures that the side of the unit
is checked first before the potentially complex rest of the filter is
evaluated.


Compare: https://github.com/wesnoth/wesnoth/compare/9bb6cbb82c46...6c38b8ce934e
      **NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the Commits mailing list