Warning : Contains stuff on COVID-19, not recommended if Corona is a sensitive topic to you
Here's the link to the website
I made a Corona Transfer Simulation using JavaScript, p5 specifically. It starts with a bunch of circles bouncing around with random velocity in a box, and one of them is red and infected with corona-virus. If the red circle collides with a healthy one, the healthy one gets infected. In a very short period of time, all the balls get infected.
This is actually just part of a game I'm working on, but my friend Krishna Karthik wanted to see the Simulation part so I am making this post.
Hopefully, this shows you why Social Distancing is important and must be followed. Anyways, stay safe, bye!
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
@Krishna Karthik I can't write simulation notes as good as yours lol
Log in to reply
@Percy Jackson Woah... that looks so good! How did you write the collision bit? Is it based on momentum transfer? That's really cool :)
Log in to reply
Thanks!!!
So for the collision function -
Step 1 - Check distance between center's of two balls.
Step 2 - Define a minimum distance before which they collide and change velocity
Step 3 - Check if distance is less than or equal to minimum distance
Step 4 - If distance is greater than min. distance, leave it be, otherwise do Step 5
Step 5 - I'm not really sure how to define this, I just put together a function with code that I learnt from different places. It is kinda based on momentum transfer, but its not exactly accurate. It calculates the acceleration/retardation and direction of the ball after collision then changes the values accordingly.
Step 6 - Iterate over every pair of balls. This above function works for only 2 balls. I used a for loop to iterate it over every single ball that I make.
That's all. You can look at the code in the link I gave below the image. It'll help clear out my vague step 5 lol :)
And now I need to see the simulation where social distance comes into the picture too
Log in to reply
No!!! More simulation = more JS = more work!!! lol I'm not sure I can do that...
Log in to reply
Hmm.. sad :( ): (whichever type you are)
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
now
I hadn’t saved what I did last don’t exactly remember it either, so had to do again, did something different this time so can’t see them tagging each other at collision very wellLog in to reply
Log in to reply
Just the “a” in colBall was added
Deleted infect(not required) and also deleted this
Log in to reply
You know that in Washington post are a paper with the same variables and enviroemnt simulator. The thing now is to made a enviroment behavior of COVID and with in my case do a matplotlib graphs represents different para meterse of the simulation of the curve of (death, neutral, contagious) and compare the curve of real one and the simulator. Anyway good job of thar program in JavaScript I made my simulator in Python using now streamlit and before pygame.
@Jason Gomez - Can you mention me in that Primes to a Million thing again if it is important? I dismissed all my notifications.
Log in to reply
You can find it on my about easily
Log in to reply
Found it and saw your comment. Took me about 15-20 seconds to completely load. Why the heck have you posted a million prime numbers?
Log in to reply
Log in to reply
@Jason Gomez - I have a problem. I'm kinda conflicted about the Mathathon thing. I wanna do it, but at the same time, I'm not sure I do. I want it to continue, but I just don't have enough time and don't wanna let everyone who joined down. Thoughts?
Log in to reply
If you really have no time then don't do it, other than Jeff and Nscs all the other guys are new to Mathathon, so I don't expect that your decision will let them down, so the only guys you will be letting down is Jeff, Nscs and me
Log in to reply
Would you like to be a judge?
Dam, I would be honoured to be (I hope you weren’t joking)
Log in to reply
Log in to reply
Log in to reply
Log in to reply
(guess which method I used)
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Have you and Siddharth been messing around in the Mathathon note? I got about 20 notifs from you guys, and I saw that thread about Siddharth spamming which confused me...@Jason Gomez
Log in to reply
Nah none of the comments were deleted, I many of my comments were deleted because I was “organising your note”
We were just editing the comments we had already put and got many messages thru in just four comments
Log in to reply
That’s the one where I talked about you being confused
Log in to reply