Esempio n. 1
0
        public static string AsString(this byte[,] squares, string row_sep = "\n", string col_sep = "\t")
        {
            var sb   = new StringBuilder();
            var disp = squares.AsDisplayValues();

            for (var x = 0; x < SZ; x++)
            {
                sb.Append(string.Join(col_sep,
                                      Enumerable.Range(0, SZ)
                                      .Select(y => $"{disp[x, y]}")));
                sb.Append(row_sep);
            }
            return(sb.ToString().TrimEnd()); //we know by default we'll have a trailing newline
        }
Esempio n. 2
0
 public static float Score(this byte[,] squares) => squares.AsDisplayValues().Cast <int>().Sum();