// Implement a ParticleRepeller class. A ParticleRepeller is a Particle, which pushes other particles away from it // (i.e. accelerates them in a direction, opposite of the direction in which the repeller is). // The repeller has an effect only on particles within a certain radius (see Euclidean distance). static void Main() { IRenderer renderer = new ConsoleRenderer(MaxRows, MaxCols); IParticleOperator particleOperator = new ParticleUpdater(); // Add particle repeller (appears as 'R' on the console) MatrixCoords repellerPosition = new MatrixCoords(MaxRows * 2 / 4, MaxCols * 2 / 4); MatrixCoords repellerSpeed = new MatrixCoords(0, 0); int repellerGravity = -4; // negative for antigravity ParticleRepeller repeller = new ParticleRepeller(repellerPosition, repellerSpeed, repellerGravity); // Use a field engine - derives from Engine, but can affect the speed of the particles, // the center of the field is the repeller int sleepTimeMs = 50; FieldEngine engine = new FieldEngine(renderer, particleOperator, sleepTimeMs, repeller); engine.AddParticle(repeller); // Add emmitter for free particles (appears as 'E' on the console) MatrixCoords emitterPosition = new MatrixCoords(MaxRows / 4, MaxCols / 4); MatrixCoords emitterSpeed = new MatrixCoords(4, 4); int particleLifeTicks = 30; ParticleEmitter emitter = new ParticleEmitter(emitterPosition, emitterSpeed, particleLifeTicks); engine.AddParticle(emitter); SetConsole(); engine.Run(); }
static void Main(string[] args) { var renderer = new ConsoleRenderer(SimulationRows, SimulationCols); var particleOperator = new AdvancedParticleOperationExtension(); var particles = new List<Particle>() { new Particle(new MatrixCoords(10, 10), new MatrixCoords(0, 1)), //new ParticleEmitter(new MatrixCoords(5, 10), new MatrixCoords(0, 0), RandomGenerator), // new ParticleEmitter(new MatrixCoords(5, 20), new MatrixCoords(0, 0), RandomGenerator), //new VariousLifetimeParticleEmitter(new MatrixCoords(29, 1), new MatrixCoords(0, 0), RandomGenerator), new ParticleAttractor(new MatrixCoords(15, 8), new MatrixCoords(), 5), new ParticleAttractor(new MatrixCoords(15, 20), new MatrixCoords(), 40), new ChaoticParticle(new MatrixCoords(15, 15), new MatrixCoords(1, 5)), new ChickenParticle(new MatrixCoords(10, 10), new MatrixCoords(1, 5)), new RepellerParticle(new MatrixCoords(10,3), new MatrixCoords(),5,5), new RepellerParticle(new MatrixCoords(10,18), new MatrixCoords(),5,5) }; var engine = new Engine(renderer, particleOperator, particles, 500); engine.Run(); }
static void Main(string[] args) { var renderer = new ConsoleRenderer(SimulationRows, SimulationCols); //var particleOperator = new AdvancedParticleOperator(); // Initialize the repeller particle operator var repellerparticleOperator = new RepellerParticleOperator(); var particles = new List<Particle>() { new Particle(new MatrixCoords(5, 5), new MatrixCoords(1, 1)), //new ParticleEmitter(new MatrixCoords(5, 10), new MatrixCoords(0, 0), RandomGenerator), //new ParticleEmitter(new MatrixCoords(5, 20), new MatrixCoords(0, 0), RandomGenerator), //new VariousLifetimeParticleEmitter(new MatrixCoords(29, 1), new MatrixCoords(0, 0), RandomGenerator), //new ParticleAttractor(new MatrixCoords(15, 8), new MatrixCoords(), 5), //new ParticleAttractor(new MatrixCoords(15, 20), new MatrixCoords(), 1), // 01. Create a ChaoticParticle //new ChaoticParticle(new MatrixCoords(), new MatrixCoords(), new MatrixCoords(SimulationRows, SimulationCols), RandomGenerator), // 03. Create a ChickenParticle //new ChickenParticle(new MatrixCoords(), new MatrixCoords(), new MatrixCoords(SimulationRows, SimulationCols), RandomGenerator, 5), // 05. Implement a ParticleRepeller //new ParticleRepeller(new MatrixCoords(13, 13), new MatrixCoords(), 2, 5), }; // Using the repeller particle operator var engine = new Engine(renderer, repellerparticleOperator, particles, 500); engine.Run(); }
static void Main() { var renderer = new ConsoleRenderer(Rows,Col); var particleOperator = new ParticleUpdater(); var engine = new Engine(renderer,particleOperator,null,300); GenerateParticle(engine); engine.Run(); }
static void Main(string[] args) { var renderer = new ConsoleRenderer(Rows, Cols); var particleOperator = new ExtendedParticleOperator(); var engine = new Engine(renderer, particleOperator, null, 300); GenerateInitialData(engine); engine.Run(); }
public static void Main() { var renderer = new ConsoleRenderer(Rows, Cols); var particleOperator = new AdvancedParticalUpdater(); var engine = new Engine(renderer, particleOperator, null, 300); GenerateInitialData(engine); engine.Run(); }
static void Main(string[] args) { var renderer = new ConsoleRenderer(SimulationRows, SimulationCols); var particleOperator = new ParticleUpdater(); var particles = new List<Particle>() { new Particle(new MatrixCoords(5,5), new MatrixCoords(1, 1)), new ParticleEmitter(new MatrixCoords(5,10), new MatrixCoords(0, 0), new Random()) }; var engine = new Engine(renderer, particleOperator, particles); engine.Run(); }
// Create a ChickenParticle class. // The ChickenParticle class moves like a ChaoticParticle, // but randomly stops at different positions for several simulation ticks and, // for each of those stops, creates (lays) a new ChickenParticle. static void Main() { IRenderer renderer = new ConsoleRenderer(MaxRows, MaxCols); IParticleOperator particleOperator = new ParticleUpdater(); int sleepTimeMs = 250; Engine engine = new Engine(renderer, particleOperator, sleepTimeMs); // Create a ChickenParticle (it will spawn other particles) MatrixCoords initialPosition = new MatrixCoords(MaxRows / 2, MaxCols / 2); MatrixCoords initialSpeed = new MatrixCoords(0, 0); Particle chickenParticle = new ChickenParticle(initialPosition, initialSpeed); engine.AddParticle(chickenParticle); SetConsole(); engine.Run(); }
static void Main() { var renderer = new ConsoleRenderer(SimulationRows, SimulationCols); var particleOperator = new MoreAdvancedParticleSystem(); var particles = new List<Particle> { new ChaoticParticle(new MatrixCoords(15, 15), new MatrixCoords(1, 1), RandomGenerator), new ChickenParticle(new MatrixCoords(17, 16), new MatrixCoords(1, 1), RandomGenerator), new Particle(new MatrixCoords(13, 20), new MatrixCoords()), new ParticleRepeller(new MatrixCoords(15, 25), new MatrixCoords(), 10, 1), new ParticleRepeller(new MatrixCoords(10, 15), new MatrixCoords(), 10, 2), }; var engine = new Engine(renderer, particleOperator, particles, 100); engine.Run(); }
static void Main() { var renderer = new ConsoleRenderer(20, 40); var particleOperator = new RepulsionParticleUpdater(); var particles = new List <Particle>() { new ChaoticParticle(new MatrixCoords(10, 20), new MatrixCoords(0, 0), RandomGenerator), //new ChickenParticle(new MatrixCoords(8, 18), new MatrixCoords(0,0), RandomGenerator), new Particle(new MatrixCoords(10, 4), new MatrixCoords(0, 1)), new Particle(new MatrixCoords(10, 36), new MatrixCoords(0, -1)), new ParticleRepeller(new MatrixCoords(10, 20), new MatrixCoords(0, 0), 6), new ParticleRepeller(new MatrixCoords(10, 0), new MatrixCoords(0, 0), 2), new ParticleRepeller(new MatrixCoords(10, 39), new MatrixCoords(0, 0), 2) }; Engine particleEngine = new Engine(renderer, particleOperator, particles, 500); particleEngine.Run(); }
static void Main(string[] args) { var renderer = new ConsoleRenderer(SimulationRows, SimulationCols); var particleOperator = new AdvancedParticleOperator(); var particles = new List<Particle>() { new Particle(new MatrixCoords(5, 5), new MatrixCoords(1, 1)), //new Particle(new MatrixCoords(5, 5), new MatrixCoords(1, 2)), //new ParticleEmitter(new MatrixCoords(5, 10), new MatrixCoords(0, 0), RandomGenerator), //new ParticleEmitter(new MatrixCoords(5, 20), new MatrixCoords(0, 0), RandomGenerator), //new VariousLifetimeParticleEmitter(new MatrixCoords(29, 1), new MatrixCoords(0, 0), RandomGenerator), //new DyingParticle(new MatrixCoords(5, 20), new MatrixCoords(4, 4), 1), new ChaoticParticle(new MatrixCoords(7, 9), new MatrixCoords(6, 4), new Random()), new ParticleAttractor(new MatrixCoords(15, 8), new MatrixCoords(), 5), //new ParticleAttractor(new MatrixCoords(15, 20), new MatrixCoords(), 1), }; var engine = new Engine(renderer, particleOperator, particles, 500); engine.Run(); }
static void Main(string[] args) { Random random = new Random(); var renderer = new ConsoleRenderer(SimulationRows, SimulationCols); var particleOperator = new AdvancedParticleOperator(); var particles = new List<Particle>() { //new Particle(new MatrixCoords(5, 5), new MatrixCoords(1, 1)), //new ParticleEmitter(new MatrixCoords(5, 10), new MatrixCoords(0, 0), RandomGenerator), //new ParticleEmitter(new MatrixCoords(5, 20), new MatrixCoords(0, 0), RandomGenerator), //new VariousLifetimeParticleEmitter(new MatrixCoords(29, 1), new MatrixCoords(0, 0), RandomGenerator), //new ChaoticParticle(new MatrixCoords(20, 25), new MatrixCoords (1,1)), // First and Second exercises new ChickenParticle(new MatrixCoords(14,10),new MatrixCoords(1,1), 3, 3), //Third and Fourth exercises //new ParticleRepeller(new MatrixCoords(12,20), new MatrixCoords(0,0), 3, 8) // Fifth and Sixth exercises }; var engine = new Engine(renderer, particleOperator, particles, 500); engine.Run(); }
static void Main() { // Set console window width and height Console.BufferWidth = Console.WindowWidth = GameCols + 1; Console.WindowHeight = Console.WindowHeight = GameRows + 2; ConsoleRenderer renderer = new ConsoleRenderer(GameRows, GameCols); ParticleUpdater updater = new AdvancedParticleUpdater(); // Create a list of particles List<Particle> particles = new List<Particle>() { // normal particle new Particle(new MatrixCoords(4, 0), new MatrixCoords(0, 1)), // emitter particle new VariousParticleEmitter(new MatrixCoords(7, 5), new MatrixCoords(0, 0), RandomGenerator), // repeller particles new ParticleRepeller(new MatrixCoords(18, 25), new MatrixCoords(0, 0), 1), new ParticleRepeller(new MatrixCoords(3, 65), new MatrixCoords(0, 0), 1), new ParticleRepeller(new MatrixCoords(12, 57), new MatrixCoords(0, 0), 1), // attractor particle new ParticleAttractor(new MatrixCoords(12, 50), new MatrixCoords(0, 0), 1), // chaotic particle new ChaoticParticle(new MatrixCoords(12, 40), new MatrixCoords(0, 0), RandomGenerator), // chicken particle new ChickenParticle(new MatrixCoords(12, 40), new MatrixCoords(0, 0), RandomGenerator) }; // Create and run some engine Engine engine = new Engine(renderer, updater, particles, Delay); engine.Run(); }
static void Main(string[] args) { var renderer = new ConsoleRenderer(Rows, Cols); var particleOperator = new AdvancedParticleOperatorWithRepeller(); var engine = new Engine(renderer, particleOperator, null, 300); var chaoticParticle = new ChaoticParticle(new MatrixCoords(20, 20), new MatrixCoords(0, 0), RandomGenerator, 1); engine.AddParticle(chaoticParticle); var attractor = new ParticleAttractor(new MatrixCoords(15, 15), new MatrixCoords(0, 0), 2); engine.AddParticle(attractor); var repeller = new ParticleRepeller(new MatrixCoords(20, 15), new MatrixCoords(0, 0), 1, 5); engine.AddParticle(repeller); engine.AddParticle(new Particle(new MatrixCoords(20, 20), new MatrixCoords(0, 0))); var chickenParticle = new ChickenParticle(new MatrixCoords(15, 15), new MatrixCoords(0, 0), RandomGenerator, 3, new MatrixCoords(3, 6)); engine.AddParticle(chickenParticle); //GenerateInitialData(engine); engine.Run(); }