mirror of https://github.com/captn3m0/modernart
Gecode solver functional
parent
5d2aa084de
commit
cbaf338cdf
|
@ -119,7 +119,7 @@ Outside of constraints, I've to get to the following:
|
|||
|
||||
- [ ] Improve output formatting
|
||||
- [ ] Get JSON output to render outside of the solver
|
||||
- [ ] Get Gecode and other solvers working
|
||||
- [x] Get Gecode and other solvers working
|
||||
|
||||
## Cards Dealt Table
|
||||
|
||||
|
|
16
gameplay.mzn
16
gameplay.mzn
|
@ -88,34 +88,34 @@ constraint first_player[Round4] = if last_player[Round3] = card(Players) then 1
|
|||
constraint Pn1 = if (first_player[Round1] < last_player[Round1]) then
|
||||
first_player[Round1]..last_player[Round1]
|
||||
else
|
||||
set_diff(Players,first_player[Round1]..last_player[Round1])
|
||||
Players diff (first_player[Round1]..last_player[Round1])
|
||||
endif;
|
||||
|
||||
|
||||
constraint Pn2 = if (first_player[Round2] < last_player[Round2]) then
|
||||
first_player[Round2]..last_player[Round2]
|
||||
else
|
||||
set_diff(Players,first_player[Round2]..last_player[Round2])
|
||||
Players diff first_player[Round2]..last_player[Round2]
|
||||
endif;
|
||||
|
||||
|
||||
constraint Pn3 = if (first_player[Round3] < last_player[Round3]) then
|
||||
first_player[Round3]..last_player[Round3]
|
||||
else
|
||||
set_diff(Players,first_player[Round3]..last_player[Round3])
|
||||
Players diff first_player[Round3]..last_player[Round3]
|
||||
endif;
|
||||
|
||||
|
||||
constraint Pn4 = if (first_player[Round4] < last_player[Round4]) then
|
||||
first_player[Round4]..last_player[Round4]
|
||||
else
|
||||
set_diff(Players,first_player[Round4]..last_player[Round4])
|
||||
Players diff first_player[Round4]..last_player[Round4]
|
||||
endif;
|
||||
|
||||
constraint Px1 = set_diff(Players,Pn1);
|
||||
constraint Px2 = set_diff(Players,Pn2);
|
||||
constraint Px3 = set_diff(Players,Pn3);
|
||||
constraint Px4 = set_diff(Players,Pn4);
|
||||
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]);
|
||||
|
|
|
@ -8,7 +8,9 @@ array[Rounds,1..card(Artists)] of var Artists: sorted_artists_per_round;
|
|||
array[Rounds,Artists] of var bool: IsArtistRanked;
|
||||
|
||||
% Decide the top artists by picking the cards per artist for that round, and sorting them
|
||||
constraint forall(r in Rounds)(row(sorted_artists_per_round,r)= reverse(arg_sort(row(CardsForArtist, r))));
|
||||
constraint forall(r in Rounds)(
|
||||
row(sorted_artists_per_round,r)= reverse(arg_sort(row(CardsForArtist, r)))
|
||||
);
|
||||
|
||||
% Top three artists get ranking score in each round as 3,2,1 others get 0
|
||||
constraint forall(r in Rounds) (ranking_score_per_artist_per_round[r, row(sorted_artists_per_round,r)[1]] = 3);
|
||||
|
|
Loading…
Reference in New Issue