예제 #1
0
파일: BGMoveSet.cs 프로젝트: wdjong/BGC
 public void Update(BGMoveSet moveSet)
 {
     BGMoves.Clear();
     Di1   = moveSet.Di1;
     Di2   = moveSet.Di2;
     Score = moveSet.Score;
     foreach (BGMove move in moveSet.BGMoves)
     {
         BGMove bestMove = new BGMove(move);
         BGMoves.Add(bestMove);
     }
 }
예제 #2
0
파일: BGMoveSet.cs 프로젝트: wdjong/BGC
        public string GetNotation(bool verbose)
        {
            //
            // cf https://en.wikipedia.org/wiki/Backgammon_notation
            string result = "";// Di1.ToString() + "-" + Di2.ToString() + Environment.NewLine;
            string checkerHit;

            foreach (var move in BGMoves) //.OrderBy(m => m.SeqOrder))
            {
                checkerHit = (move.CheckerHit == true) ? "*" : "";
                if (verbose)
                {
                    result += move.PieceID.ToString()
                              + ":" + move.SeqOrder.ToString()
                              + ":" + move.Di.ToString()
                              + " " + move.FMove.ToString()
                              + "/" + move.TMove.ToString()
                              + checkerHit
                              + Environment.NewLine;
                }
                else
                {
                    move.TMove = (move.TMove < 0) ? 0 : move.TMove;
                    if (move.FMove > 0)
                    {
                        result += move.FMove.ToString().Replace("25", "bar")
                                  + "/" + move.TMove.ToString()
                                  + checkerHit;
                        result = result.Replace("/0", "/off");
                    }
                    else
                    {
                        result += "(no play)";
                    }
                    // If there's only 1 move add (no play)
                    result = (BGMoves.Count == 1) ? result += " (no play)" : result;
                    // If it's the last move in the sequence add CR LF
                    result = (move.SeqOrder == BGMoves.Last().SeqOrder) ? result += Environment.NewLine : result += " ";
                }
            }
            return(result);
        }