Exemplo n.º 1
0
        //// FlipParsedCoordinates is only called from GameAux.FlipCoordinates, which is only used for
        //// writing files.  Hence, we represent pass coordinates as the empty string.  Apparently, some
        //// programs use "tt" due to older format conventions.
        ////
        public static string FlipParsedCoordinates(string coords, int size)
        {
            var mcoords = GoBoardAux.ParsedToModelCoordinates(coords);

            if (mcoords.Item1 == GoBoardAux.NoIndex)
            {
                return("");
            }
            else
            {
                // C# fails mutually distinct types on char and int, and string constructor lame.
                // Must cons array so that string constructor doesn't interpret second char as count.
                return(new string(new char[] { letters[size + 1 - mcoords.Item2], letters[size + 1 - mcoords.Item1] }));
            }
        }
Exemplo n.º 2
0
        //// parsed_label_model_coordinates takes a parsed properties and returns as
        //// multiple values the row, col (in terms of the model used by goboard.py),
        //// and the label letter.  Data should be "<letter><letter>:<letter>".
        ////
        public static Tuple <int, int, char> ParsedLabelModelCoordinates(string data)
        {
            var tmp = GoBoardAux.ParsedToModelCoordinates(data);

            return(new Tuple <int, int, char>(tmp.Item1, tmp.Item2, data[3]));
        }