Exemplo n.º 1
0
 public void GenerateNewCoords(AtomsGrid grid)
 {
     this.X = RandomContainer.NextInt(0, grid.X);
     this.Y = RandomContainer.NextInt(0, grid.Y);
     this.Z = RandomContainer.NextInt(0, grid.Z);
     Console.WriteLine($"New generated Coords: {X}, {Y}, {Z} and tries: {Tries}");
     this.Tries++;
 }
Exemplo n.º 2
0
        public static Atom GenerateAtom(AtomsGrid grid)
        {
            Atom atom = new Atom(-1, -1, -1);

            do
            {
                atom.GenerateNewCoords(grid);
            } while (!grid.AddToSet(atom));

            return(atom);
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            var grid = AtomsGrid.ReadGrid();
            int n    = Reader.Read <int>("Enter amount of atoms to be placed inside Grid", "Smth wrong, reenter pls",
                                         (el) => el > 0 && el <= (grid.X + 1) * (grid.Y + 1) * (grid.Z + 1));

            for (int i = 0; i < n; ++i)
            {
                Atom atom = Atom.GenerateAtom(grid);
                Console.WriteLine($"\n\n Tries: {atom.Tries} \n");
            }
        }