public WoodsyGameData(List <String> inputParticipantIds)
 {
     // Constructor: create a Woodsy game data structure based on the supplied player ID's.
     this.lastErrorMessage = "";
     this.participantIds.Clear();
     this.remainingHouses.Clear();
     this.remainingPersons.Clear();
     this.personScores = new int[Pieces.numberOfPeople()];
     this.personScoresAtStartOfTurn = new int[Pieces.numberOfPeople()];
     for (int i = 1; i <= Pieces.numberOfPeople(); i++)
     {
         this.remainingHouses.Add(Pieces.createHousePiece(i));
         this.remainingPersons.Add(Pieces.createPersonPiece(i));
         this.personScores[i - 1] = this.maxPointsForGoal();
     }
     this.piecesToPlay.Clear();
     this.boards.Clear();
     this.scores.Clear();
     //
     //  prepare the piece bag
     this.pieceBag      = Pieces.pieces();
     this.minPiecesLeft = this.pieceBag.Length;
     //
     //  now, add all the known  participants.
     //
     foreach (String thisParticipantId in inputParticipantIds)
     {
         if (thisParticipantId != null)
         {
             this.addParticipantIfNeeded(thisParticipantId);
         }
     }
 }
Beispiel #2
0
 //-- Determining if a board is a winning board
 public bool isWinningBoard()
 {
     for (int i = 1; i <= Pieces.numberOfPeople(); i++)
     {
         Coordinates ch = this.locateHouse(i);
         Coordinates cp = this.locatePerson(i);
         if (!ch.notFound() && !cp.notFound())
         {
             if (!ch.equals(cp))
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }