Example #1
0
 private PegBoard(IPegBoardSource pegBoardSource)
 {
     Columns      = pegBoardSource.Columns * 2 - 1;
     Rows         = pegBoardSource.Rows;
     Goal         = pegBoardSource.Goal;
     MissingPegs  = pegBoardSource.MissingPegs;
     GoalPeg      = Peg.Create(pegBoardSource.Rows, pegBoardSource.Goal * 2 + 1);
     _pegsFactory = new Peg.Factory(Rows, Columns, MissingPegs);
 }
Example #2
0
 public IEnumerable <Peg> GetBestPositions()
 {
     return(_probabilityByColumn
            .Select(keyValue => Peg.Create(1, keyValue.Key, keyValue.Value))
            .OrderByDescending(peg => peg.Probability));
 }