Awards can be given to the same artist in the same round

This commit is contained in:
Nemo 2020-07-20 19:16:05 +05:30
parent 3e64db3c10
commit f0f1f978b4
2 changed files with 34 additions and 23 deletions

View File

@ -1,31 +1,35 @@
/**
AWARDS
This file deals with the awards, which gives 2 points
cumulative score benefit to the artist starting from the round
the award was played in
There are 5 awards - one per artist
*/
% Whether an artist won an award in a given round
array[Rounds,Artists] of var bool: awards_per_round_per_artist;
% AWARDS
% This file deals with the awards, which gives 2 points
% cumulative score benefit to the artist starting from the round
% the award was played in
% There are 5 awards - one per artist
% The awards can be given to any artist
% The net result of this code should be to increase awards_per_round_per_artist[r,a]
% by 2 for every award that a gets in round r.
array[Rounds,Artists] of var {0,2}: award_bonus_per_round_per_artist;
% Total number of awards for each artist = 1
constraint forall(a in Artists) ( sum(col(awards_per_round_per_artist,a)) = 1 );
include "globals.mzn";
% This is what we export
array[Rounds,Artists] of var {0,2,4,6,8,10}: award_bonus_per_round_per_artist;
% Covered better in Symbols
% TODO: Remove after consideration?
% awards can only be given if an artist's card was played that turn
constraint forall(r in Rounds, a in Artists) (
awards_per_round_per_artist[r,a] = true -> CardsForArtist[r,a] > 0
AwardPlayedInRound[a] = r /\ AwardGiven[a] -> CardsForArtist[r,a] > 0
);
% Set award_bonus_per_round_per_artist = array[5] with bonus that can be added to ranking scores
% Which ROUND was this award played in
array[Artists] of var Rounds: AwardPlayedInRound;
array[Artists] of var Artists: AwardedArtist;
% The above 2 should be good, but we need to account for the cases
% where the award was not given at all.
array[Artists] of var bool: AwardGiven;
constraint forall(r in Rounds, a in Artists) (
award_bonus_per_round_per_artist[r,a] =
if awards_per_round_per_artist[r,a] then
2
else
0
endif
);
2 *
% Gives us a list of true/false
sum(aa in Artists) (if AwardPlayedInRound[aa] = r /\ AwardGiven[aa] /\ AwardedArtist[aa] = a then true else false endif)
);

View File

@ -9,7 +9,14 @@
% and may ultimately end up replacing separate symbol counters
constraint forall(r in Rounds, a in Artists) (
% Total number of cards played by all players
% MINUS total number of Draw One Cards played by all players
sum (p in Players) (
visible_count_per_round_per_artist_per_player[r,p,a] - DrawOneCard[r,p,a]
) >= awards_per_round_per_artist[r,a]
)
% MINUS total number of awards given this round
- (if AwardPlayedInRound[a] = r /\ AwardGiven[a] then 1 else 0 endif)
% Is the number of Symbol Cards played this turn
% and it can't be negative
>= 0
);