// // A Match is between two players in a timeslot, each in a different boat // The boats are constrained integer variables and must be decided // import static choco.Choco.*; import choco.kernel.model.variables.integer.IntegerVariable; public class Match { int player1, player2; // the two players in the match int timeSlot; // the time slot the match takes place in IntegerVariable boat1, boat2; // boats for players 1 and 2 Match(int player1, int player2, int timeSlot, int numberOfBoats){ this.player1 = player1; this.player2 = player2; this.timeSlot = timeSlot; boat1 = makeIntVar("boat-"+ timeSlot +"-skipper-"+ player1,1,numberOfBoats); boat2 = makeIntVar("boat-"+ timeSlot +"-skipper-"+ player2,1,numberOfBoats); } // // NOTE: Used in Phase1a, boat allocation // create a match between two players in a given timeslot // where each player can choose from a numberOfBoats // Match(int player1, int player2,int timeSlot){ this.player1 = player1; this.player2 = player2; this.timeSlot = timeSlot; boat1 = makeIntVar("orient",0,1); boat2 = makeIntVar("orient",0,1); } // // NOTE: used in Phase1b, match orientation // public String toString(){ return timeSlot +": ("+ player1 +","+ player2 +")"; } }