How to create a random simulation?

I played this flash game and after I received the initial ("lol, fire") reaction, I began to wonder how I could reproduce this behavior with a change in contact in programming. I think this is a bit like honeypot xkcd .

I thought to start with a scenario when the particles separate from each other and make up the walls. The sequence begins with a certain number of “mutant” particles, and when these mutants collide with ordinary particles, they themselves become mutants. Subsequently, I could work on more interesting things.

My problem is how to start with this. I plan to do this in C # using the Drawing.NET elements (although I'm pretty new to C # - if there is another part of .NET that I should use, let me know), but if there are any general documents about this 'd be interested to read them (if they are available online, of course).

Thanks Ross

+3
source share
2 answers

, , , . , , , , , .

, , . position = position + velocity * dt; dt - . dt , ... .

, , x y , ,

if(Math.Abs(position.x_component + velocity.x_component * dt) > x_bound) 
    velocity.y_component = -velocity.y_component;

if(Math.Abs(position.y_component + velocity.y_component * dt) > y_bound)
    velocity.x_component = -velocity.x_component;

dt, , , - . , .

, , , , . .. , . , , .

...

, .

+4

Source: https://habr.com/ru/post/1702549/


All Articles