Пример #1
0
        internal static Delta DecodeNd(int nd)
        {
            Requires.Range(nd, nameof(nd), 0, 26);

            int dx = (nd / 9) % 3 - 1;
            int dy = (nd / 3) % 3 - 1;
            int dz = (nd / 1) % 3 - 1;

            Delta decoded = Delta.Of(dx, dy, dz);

            Requires.Arg(decoded.IsNd(), nameof(nd),
                         $"{nd} is not a valid encoding of a near difference.");
            return(decoded);
        }
Пример #2
0
 public static Command Fission(Delta nd, int m)
 {
     Requires.Arg(nd.IsNd(), nameof(nd), "Argument is not a valid nd.");
     Requires.Range(m, nameof(m), 0, 255);
     return(new FissionCommand(nd, m));
 }
Пример #3
0
 public static Command Fill(Delta nd)
 {
     Requires.Arg(nd.IsNd(), nameof(nd), "Argument is not a valid nd.");
     return(new FillCommand(nd));
 }