Clean up constraints, hopefully improve performance, switch to 2p modelling
This commit is contained in:
parent
0dd4133d2b
commit
7a4bc6a1e9
25
gameplay.mzn
25
gameplay.mzn
|
@ -58,7 +58,7 @@ constraint forall(r in Rounds, p in Players) (
|
|||
StartingCardsInHand[r,p] >= TotalCardsPlayed[r,p]
|
||||
);
|
||||
|
||||
% TODO: Move to simultanouse
|
||||
% TODO: Move to simultaneous
|
||||
% The last player must have played atleast one card of the top artist
|
||||
constraint forall(r in Rounds) (
|
||||
visible_count_per_round_per_artist_per_player[r,last_player[r],sorted_artists_per_round[r,1]] >=1
|
||||
|
@ -74,11 +74,6 @@ var set of Players: Pn1;
|
|||
var set of Players: Pn2;
|
||||
var set of Players: Pn3;
|
||||
var set of Players: Pn4;
|
||||
%All players who played sub-nominal turns
|
||||
var set of Players: Px1;
|
||||
var set of Players: Px2;
|
||||
var set of Players: Px3;
|
||||
var set of Players: Px4;
|
||||
|
||||
% First player in all future rounds is determined by the next player from the player who finished previous round
|
||||
constraint first_player[Round2] = if last_player[Round1] = card(Players) then 1 else enum_next(Players, last_player[Round1]) endif;
|
||||
|
@ -112,20 +107,10 @@ constraint Pn4 = if (first_player[Round4] < last_player[Round4]) then
|
|||
Players diff first_player[Round4]..last_player[Round4]
|
||||
endif;
|
||||
|
||||
constraint Px1 = Players diff Pn1;
|
||||
constraint Px2 = Players diff Pn2;
|
||||
constraint Px3 = Players diff Pn3;
|
||||
constraint Px4 = Players diff Pn4;
|
||||
|
||||
constraint forall(p in Players) (p in Pn1 -> TotalCardsPlayed[Round1, p] = NominalTurnCount[Round1]);
|
||||
constraint forall(p in Players) (p in Pn2 -> TotalCardsPlayed[Round2, p] = NominalTurnCount[Round2]);
|
||||
constraint forall(p in Players) (p in Pn3 -> TotalCardsPlayed[Round3, p] = NominalTurnCount[Round3]);
|
||||
constraint forall(p in Players) (p in Pn3 -> TotalCardsPlayed[Round4, p] = NominalTurnCount[Round4]);
|
||||
|
||||
constraint forall(p in Players) (p in Px1 -> TotalCardsPlayed[Round1, p] = NominalTurnCount[Round1] - 1);
|
||||
constraint forall(p in Players) (p in Px2 -> TotalCardsPlayed[Round2, p] = NominalTurnCount[Round2] - 1);
|
||||
constraint forall(p in Players) (p in Px3 -> TotalCardsPlayed[Round3, p] = NominalTurnCount[Round3] - 1);
|
||||
constraint forall(p in Players) (p in Px3 -> TotalCardsPlayed[Round4, p] = NominalTurnCount[Round4] - 1);
|
||||
constraint forall(p in Players) (TotalCardsPlayed[Round1, p] = if p in Pn1 then NominalTurnCount[Round1] else NominalTurnCount[Round1] - 1 endif);
|
||||
constraint forall(p in Players) (TotalCardsPlayed[Round2, p] = if p in Pn2 then NominalTurnCount[Round2] else NominalTurnCount[Round2] - 1 endif);
|
||||
constraint forall(p in Players) (TotalCardsPlayed[Round3, p] = if p in Pn3 then NominalTurnCount[Round3] else NominalTurnCount[Round3] - 1 endif);
|
||||
constraint forall(p in Players) (TotalCardsPlayed[Round4, p] = if p in Pn3 then NominalTurnCount[Round4] else NominalTurnCount[Round4] - 1 endif);
|
||||
|
||||
% Total Playable Cards for any round are set equal to the Starting Hand
|
||||
% TODO: Move this to `drawone`
|
||||
|
|
|
@ -3,7 +3,7 @@ enum Players;
|
|||
enum Artists;
|
||||
enum Rounds;
|
||||
|
||||
Players = {Nemo, Jana, Adam};
|
||||
Players = {Nemo, Jana};
|
||||
|
||||
% The order here is opposite of what you'd usually use while playing the game
|
||||
% because this results in LiteMetal getting a higher numeric value and that makes
|
||||
|
@ -13,7 +13,7 @@ Artists = {Krypto,KarlGitter,ChristinP,Yoko,LiteMetal};
|
|||
Rounds = {Round1, Round2, Round3, Round4};
|
||||
|
||||
% Number of cards per round per player per artist
|
||||
array[Rounds,Players,Artists] of var int: visible_count_per_round_per_artist_per_player;
|
||||
array[Rounds,Players,Artists] of var 0..15: visible_count_per_round_per_artist_per_player;
|
||||
|
||||
% First player every Round
|
||||
array[Rounds] of var Players: first_player;
|
||||
|
@ -22,16 +22,19 @@ array[Rounds] of var Players: first_player;
|
|||
array[Rounds] of var Players: last_player;
|
||||
|
||||
% Total points that an artist has in a given round
|
||||
array[Rounds,Artists] of var int: total_score_per_round_per_artist;
|
||||
array[Rounds,Artists] of var 0..15: total_score_per_round_per_artist;
|
||||
|
||||
% Total number of a cards of an artist that were PLAYED this round
|
||||
array[Rounds, Artists] of var int: CardsForArtist;
|
||||
array[Rounds, Artists] of var 0..10: CardsForArtist;
|
||||
|
||||
% Number of Turns played by the closing player this round
|
||||
array[Rounds] of var int: NominalTurnCount;
|
||||
array[Rounds] of var 0..10: NominalTurnCount;
|
||||
|
||||
% constraint award_bonus_per_round_per_artist[Round1,Krypto] = true;
|
||||
% constraint award_bonus_per_round_per_artist[Round1,Yoko] = true;
|
||||
% constraint award_bonus_per_round_per_artist[Round1,ChristinP] = true;
|
||||
|
||||
% Symmetry Breaking
|
||||
constraint Score[Nemo] > Score[Jana];
|
||||
|
||||
solve maximize Score[Nemo];
|
Loading…
Reference in New Issue