[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~widelands-dev/widelands/ai_scoring_update/+merge/342831 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ai_scoring_update. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands
fixed @bunnybot merge -- https://code.launchpad.net/~widelands-dev/widelands/ai_scoring_update/+merge/342831 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ai_scoring_update. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands
Review: Approve Just 1 code style nit. can go in when it's fixed. Diff comments: > === modified file 'src/ai/ai_help_structs.cc' > --- src/ai/ai_help_structs.cc 2018-04-06 08:14:17 + > +++ src/ai/ai_help_structs.cc 2018-04-07 19:32:15 + > @@ -565,33 +565,28 @@ > const uint32_t old_land, > const uint16_t attackers, > const int16_t trained_soldiers, > -const int16_t latest_attackers, > -const uint16_t conq_ws, > const uint16_t strength, > -const uint32_t existing_ps) { > - > - const int16_t main_bonus = > -((static_cast(land - old_land) > 0 && land > max_e_land * 5 > / 6 && attackers > 0 && > - trained_soldiers > 0 && latest_attackers > 0) ? > -kBonus : > -0); > - > - const int16_t land_delta_bonus = static_cast(land - old_land) > * kLandDeltaMultiplier; > - > - const uint32_t ps_sites_bonus = kPSitesRatioMultiplier * > std::pow(existing_ps, 3) / 1000 / 1000; > - > - score = land / kCurrentLandDivider + land_delta_bonus + main_bonus + > - attackers * kAttackersMultiplier + ((attackers > 0) ? > kAttackBonus : -kAttackBonus) + > - trained_soldiers * kTrainedSoldiersScore + kConqueredWhBonus * > conq_ws + > - strength * kStrengthMultiplier + ps_sites_bonus - 500 * > kPSitesRatioMultiplier; > - > - log(" %2d %s: reviewing AI mngm. data, sc: %5d Pr.p: %d (l:%4d/%s/%4d, " > - "at:%4d(%3d),ts:%4d/%2d,cWH:%2d,str:%2d/%4d,ps:%4d/%4d)\n", > - pn, gamestring_with_leading_zeros(gametime), score, primary_parent, > - land / kCurrentLandDivider, (main_bonus) ? "*" : " ", > land_delta_bonus, > - attackers * kAttackersMultiplier, latest_attackers, > trained_soldiers * kTrainedSoldiersScore, > - trained_soldiers, conq_ws, strength, strength * > kStrengthMultiplier, existing_ps, > - ps_sites_bonus); > +const uint32_t existing_ps, > +const uint32_t first_iron_mine_time) { > + > +// bonuses (1000 or nothing) > +const uint16_t territory_bonus = (land > old_land || land > max_e_land) > ? 1000 : 0; > +const uint16_t iron_mine_bonus = (first_iron_mine_time < 2 * 60 * 60 * > 1000) ? 1000 : 0; > +const uint16_t attack_bonus = (attackers > 0) ? 1000 : 0; > +const uint16_t training_bonus = (trained_soldiers > 0) ? 1000 : 0; > + > + // scores (numbers dependant on performance) > +const uint16_t land_score = land / kCurrentLandDivider; > +const uint16_t strength_score = std::min(strength, 100) * > kStrengthMultiplier; > +const uint16_t attack_score = std::min(attackers, 40) * 50; > +const uint32_t ps_sites_score = kPSitesRatioMultiplier * > std::pow(existing_ps, 3) / 1000 / 1000; > + > +score = territory_bonus + iron_mine_bonus + attack_bonus + > training_bonus + land_score + strength_score + ps_sites_score + attack_score; > + > +log(" %2d %s: reviewing AI mngm. data, sc: %5d Pr.p: %d (Bonuses:Te:%s > I:%s A:%s Tr:%s, Scores:Land:%5d Str:%4d PS:%4d, Att:%4d\n", > +pn, gamestring_with_leading_zeros(gametime), score, primary_parent, > +(territory_bonus)?"Y":"N", (iron_mine_bonus)?"Y":"N", > (attack_bonus)?"Y":"N", (training_bonus)?"Y":"N", Please add some blank spaces for our code style: (territory_bonus)?"Y":"N", => (territory_bonus) ? "Y" : "N", etc. > +land_score, strength_score, ps_sites_score, attack_score); > > if (score < -1 || score > 3) { > log("%2d %s: reviewing AI mngm. data, score too extreme: > %4d\n", pn, -- https://code.launchpad.net/~widelands-dev/widelands/ai_scoring_update/+merge/342831 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ai_scoring_update. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands
Continuous integration builds have changed state: Travis build 3358. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/363583953. Appveyor build 3164. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_ai_scoring_update-3164. -- https://code.launchpad.net/~widelands-dev/widelands/ai_scoring_update/+merge/342831 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands
TiborB has proposed merging lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands. Commit message: Tweaking scoring of AI performance, used for training of AI. No effect on gameplay altogether. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/ai_scoring_update/+merge/342831 Tweaking scoring of AI performance, used for training of AI. No effect on gameplay altogether. Main changes is in review() function that just print out a score with some details. Out of it I added just one variable first_iron_mine_built used only for the review function. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ai_scoring_update into lp:widelands. === modified file 'src/ai/ai_help_structs.cc' --- src/ai/ai_help_structs.cc 2018-04-06 08:14:17 + +++ src/ai/ai_help_structs.cc 2018-04-07 19:32:15 + @@ -565,33 +565,28 @@ const uint32_t old_land, const uint16_t attackers, const int16_t trained_soldiers, -const int16_t latest_attackers, -const uint16_t conq_ws, const uint16_t strength, -const uint32_t existing_ps) { - - const int16_t main_bonus = - ((static_cast(land - old_land) > 0 && land > max_e_land * 5 / 6 && attackers > 0 && - trained_soldiers > 0 && latest_attackers > 0) ? - kBonus : - 0); - - const int16_t land_delta_bonus = static_cast(land - old_land) * kLandDeltaMultiplier; - - const uint32_t ps_sites_bonus = kPSitesRatioMultiplier * std::pow(existing_ps, 3) / 1000 / 1000; - - score = land / kCurrentLandDivider + land_delta_bonus + main_bonus + - attackers * kAttackersMultiplier + ((attackers > 0) ? kAttackBonus : -kAttackBonus) + - trained_soldiers * kTrainedSoldiersScore + kConqueredWhBonus * conq_ws + - strength * kStrengthMultiplier + ps_sites_bonus - 500 * kPSitesRatioMultiplier; - - log(" %2d %s: reviewing AI mngm. data, sc: %5d Pr.p: %d (l:%4d/%s/%4d, " - "at:%4d(%3d),ts:%4d/%2d,cWH:%2d,str:%2d/%4d,ps:%4d/%4d)\n", - pn, gamestring_with_leading_zeros(gametime), score, primary_parent, - land / kCurrentLandDivider, (main_bonus) ? "*" : " ", land_delta_bonus, - attackers * kAttackersMultiplier, latest_attackers, trained_soldiers * kTrainedSoldiersScore, - trained_soldiers, conq_ws, strength, strength * kStrengthMultiplier, existing_ps, - ps_sites_bonus); +const uint32_t existing_ps, +const uint32_t first_iron_mine_time) { + +// bonuses (1000 or nothing) +const uint16_t territory_bonus = (land > old_land || land > max_e_land) ? 1000 : 0; +const uint16_t iron_mine_bonus = (first_iron_mine_time < 2 * 60 * 60 * 1000) ? 1000 : 0; +const uint16_t attack_bonus = (attackers > 0) ? 1000 : 0; +const uint16_t training_bonus = (trained_soldiers > 0) ? 1000 : 0; + + // scores (numbers dependant on performance) +const uint16_t land_score = land / kCurrentLandDivider; +const uint16_t strength_score = std::min(strength, 100) * kStrengthMultiplier; +const uint16_t attack_score = std::min(attackers, 40) * 50; +const uint32_t ps_sites_score = kPSitesRatioMultiplier * std::pow(existing_ps, 3) / 1000 / 1000; + +score = territory_bonus + iron_mine_bonus + attack_bonus + training_bonus + land_score + strength_score + ps_sites_score + attack_score; + +log(" %2d %s: reviewing AI mngm. data, sc: %5d Pr.p: %d (Bonuses:Te:%s I:%s A:%s Tr:%s, Scores:Land:%5d Str:%4d PS:%4d, Att:%4d\n", +pn, gamestring_with_leading_zeros(gametime), score, primary_parent, +(territory_bonus)?"Y":"N", (iron_mine_bonus)?"Y":"N", (attack_bonus)?"Y":"N", (training_bonus)?"Y":"N", +land_score, strength_score, ps_sites_score, attack_score); if (score < -1 || score > 3) { log("%2d %s: reviewing AI mngm. data, score too extreme: %4d\n", pn, === modified file 'src/ai/ai_help_structs.h' --- src/ai/ai_help_structs.h 2018-04-03 19:27:20 + +++ src/ai/ai_help_structs.h 2018-04-07 19:32:15 + @@ -678,10 +678,9 @@ uint32_t old_land, uint16_t attackers, int16_t trained_soldiers, - int16_t latest_attackers, - uint16_t conq_ws, uint16_t strength, - uint32_t existing_ps); + uint32_t existing_ps, + uint32_t first_iron_mine_time); void dump_data(PlayerNumber); uint16_t new_neuron_id() { ++next_neuron_id; === modified file 'src/ai/defaultai.cc' --- src/ai/defaultai.cc 2018-04-02 08:44:26 + +++ src/ai/defaultai.cc 2018-04-07 19:32:15 + @@ -108,6 +108,7 @@ next_mine_construction_due_(0), fishers_count_(0), bakeries_count_(), + first_iron_mine_built(50 * 60 * 60 * 1000), t