michaeljb / 18xx.games

Other
0 stars 0 forks source link

ability timing #15

Open michaeljb opened 3 years ago

michaeljb commented 3 years ago

pass in a lambda or something so that when .abilities() is called, the Game object can more precisely determine what "time" it is and what abilities are valid--will be very useful for ruling out abilities that should not be used

michaeljb commented 3 years ago

using branch ability-timing-fixes, have rubocop and specs passing (had to migrate a bunch of fixtures) at 114f55081

validate summary before migrating:

  "summary": {
    "failed": 3562,
    "total": 3564,
    "total_time": 50.2586157,
    "avg_time": 0.014101744023569023,
    "expected_total": 3564,
    "failures_by_title": {
      "18AL": 236,
      "18Chesapeake": 1925,
      "1889": 185,
      "18GA": 94,
      "1836Jr30": 153,
      "18MS": 75,
      "18TN": 36,
      "1817": 44,
      "18MEX": 367,
      "1817NA": 28,
      "1817WO": 6,
      "18CO": 165,
      "18Chesapeake: Off the Rails": 170,
      "18SJ": 34,
      "1828.Games": 19,
      "1830": 5,
      "18CZ": 20
    }
  }
}
michaeljb commented 3 years ago

On 353163e78 with some more tweaks to the migration script, here is the broken summary:

 "summary": {
    "failed": 123,
    "total": 134,
    "total_time": 3.455994,
    "avg_time": 0.025791,
    "expected_total": 134,
    "failures_by_title": {
      "18AL": 11,
      "18Chesapeake": 46,
      "1836Jr30": 32,
      "18GA": 16,
      "18MS": 2,
      "18CO": 6,
      "18SJ": 3,
      "18Chesapeake: Off the Rails": 2, 
      "1830": 5
    }
  }

These remaining errors don't seem salvageable; a lot of company abilities being incorrectly used out of turn, some teleport problems where the action entity is the corporation rather than the company, yet the relevant tile lay doesn't show up as a broken_action until inserting the game in the db, so repair() cannot fix those cases.

Will start with a fresh DB and re-validate/migrate, and hopefully end up at the same place.

michaeljb commented 3 years ago

TODO: revalidate/migrate 18MEX, small code change there