Coronavirus outbrake impact on PINE64
#60
I mentioned writing an epidemic simulator earlier, got it running.  Not good enough for Sourceforge yet.

An epidemic simulation program.  The screen X and Y resolution are read, then a pair of nested for loops iterate locations, for each there’s a random 10% chance that it’s populated.  There’s an array of structs containing data about each populated cell/person.  An important thing there is the X and Y location.  Each loop through the array of structs I call a day.  Every day each populated cell tries to move 1 location in a random direction if it can find an empty spot.  At the start there’s one infected cell.  There’s a 40% chance that if an uninfected cell contacts an infected one during the random moving around it becomes infected, after the 2 – 14 day incubation period.  In the array of structs are counters like till_sick which if non-zero are decremented each day until they’re zero.  Hitting zero changes the cell’s status in other ways.  For tracking neighbors there’s a shadow [x][y] array which is indexed by the current location, what it contains is the index to the array of structs if inhabited, otherwise 0.  So xy[100][100] might link to struct[33] and that’s what gets set to infected or not.  And the x,y in the struct[33] are set to 100,100, each time one is updated they both get updated.  An infected cell recovers after a random period, this tries to mimic covid-19.

There’s no quarantiinng happening, and cells don’t die either.  I tried implementing quarantining but it was too absolute: everything just stopped.  It’s easy enough to add a quarantined variable to the struct, but I need a leaky quarantine.  Sort of like we have in the US where it’s voluntary so far.  Written in C using Xlib.  There’s one known bug then I’ll clean up the source and stick it on Sourceforge.


[Image: BNgWjgE.png]


Messages In This Thread
Coronavirus outbrake impact on PINE64 - by Luke - 01-28-2020, 04:16 PM
RE: Coronavirus outbrake impact on PINE64 - by ab1jx - 03-19-2020, 04:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PINE64 FOSDEM dinner, sat 3 Feb @ 8PM tllim 8 16,300 02-09-2018, 09:03 PM
Last Post: tllim
Information FOSDEM 2018 Blog! New PINE64 Boards, Upcoming Hardware and Much More! Luke 2 51,024 02-05-2018, 05:21 AM
Last Post: Luke
  PINE64 FOSDEM dinner, sat 4 Feb @ 8PM tllim 22 38,298 02-12-2017, 09:00 PM
Last Post: tllim
  Pine64 Kickstarter pineadmin 0 8,543 12-09-2015, 05:20 AM
Last Post: pineadmin

Forum Jump:


Users browsing this thread: 1 Guest(s)