Exemple #1
0
        public string ExecuteFirstInstructions(string instructions, out BoardNode FirstBoard)
        {
            if (instructions[0] != '(')
            {
                FirstBoard = new BoardNode();
                return(instructions);
            }


            instructions = instructions.Remove(0, 2);      //removes the "(;" from the beginning of the file before starting to parse

            instructions = instructions.Replace("\n", ""); //remove page whitespace to make parsing easier.

            while (true)
            {
                int EndOfInstructionIndex = instructions.IndexOf(']');

                string NextInstruction = instructions.Substring(0, EndOfInstructionIndex + 1);

                FirstBoard = ExecuteMove(NextInstruction); //since we are not making these their own separate game moves because it's just info, we will make a temp node while we manipulate the one in the class


                instructions = instructions.Replace(NextInstruction, String.Empty);

                if (instructions[0] == ';')
                {
                    break;
                }
            }

            return(instructions);
        }
Exemple #2
0
        public BoardNode CloneBoard()
        {
            BoardNode tempNode = new BoardNode
            {
                BoardState          = new Stone[BoardSize, BoardSize],
                OpeningPlayed       = OpeningPlayed,
                AnnotatorName       = AnnotatorName,
                MarkupStyle         = MarkupStyle,
                CopyrightInfo       = CopyrightInfo,
                BlackName           = BlackName,
                BlackTeamName       = BlackTeamName,
                BlackRank           = BlackRank,
                WhiteName           = WhiteName,
                WhiteRank           = WhiteRank,
                WhiteTeamName       = WhiteTeamName,
                AppUsed             = AppUsed,
                BoardSize           = BoardSize,
                Handicap            = Handicap,
                CharsetUsed         = CharsetUsed,
                Source              = Source,
                SgfVersion          = SgfVersion,
                RuleSet             = RuleSet,
                ByoYomiSettings     = ByoYomiSettings,
                ByoYomi             = ByoYomi,
                EventName           = EventName,
                DatePlayed          = DatePlayed,
                ExtraGameInfo       = ExtraGameInfo,
                GameName            = GameName,
                Result              = Result,
                Komi                = Komi,
                Round               = Round,
                GameRecorderName    = GameRecorderName,
                PlacePlayed         = PlacePlayed,
                TimeSettings        = TimeSettings,
                NextColor           = NextColor,
                BlackByoYomiPeriods = BlackByoYomiPeriods,
                WhiteByoYomiPeriods = WhiteByoYomiPeriods,
                WhiteTimeLeft       = WhiteTimeLeft,
                WhiteByoYomiTime    = WhiteByoYomiTime,
                BlackByoYomiTime    = BlackByoYomiTime,
                BlackTimeLeft       = BlackTimeLeft,
                MoveQualitySeverity = MoveQualitySeverity
            };

            for (int i = 0; i < BoardSize; i++)
            {
                for (int j = 0; j < BoardSize; j++)
                {
                    tempNode.BoardState[i, j] = new Stone(BoardState[i, j].Color);
                }
            }

            return(tempNode);
        }
Exemple #3
0
 public void AddNodeToSection(BoardNode board)
 {
     if (ThisSection.Count == 0)
     {
         board.SetId(1);
     }
     else
     {
         board.SetId(ThisSection[ThisSection.Count - 1].Id + 1 ?? 1);
     }
 }