Beispiel #1
0
 public void MoveFromHistory(ArrayList history, int n)
 {
     InitBoard();
     for (int i = 0; i < n; i++)
     {
         HMove move = (HMove)history[i];
         if (move.Nn == string.Empty)
         {
             move.Nn = Notations.fromAlgebraicNotation(move.An);
         }
         int c, r, c2, r2;
         Notations.parse(move.Nn, out c, out r, out c2, out r2);
         Piece p = (Piece)Board._pieces[c + "x" + r];
         p.Move(c2, r2);
         Board.whites = !Board.whites;
     }
 }
Beispiel #2
0
        public string NotationToText(ArrayList history, string result, GameType type)
        {
            string output = "";

            output += "[Event \"MGChess Game\"]\r\n";
            output += "[Site \"Monterrey, México MEX\"]\r\n";
            output += "[Date \"????.??.??\"]\r\n";
            output += "[Round \"-\"]\r\n";
            output += "[White \"Human\"]\r\n";
            output += "[Black \"" + (type == GameType.HUMAN_HUMAN ? "Human" : "Computer") + "\"]\r\n";
            output += "[Result \"" + result + "\"]\r\n\r\n";

            for (int i = 0; i < history.Count; i++)
            {
                HMove move = (HMove)history[i];
                output += ((i % 2) == 0 ? ((i / 2) + 1) + ".": "") + move.An + " ";
            }
            output += (result != "*" ? result : "");

            return(output);
        }