Rob, If you make the following changes: ppl =: 25
update =: verb define im =: 5 5$ infect_display^:25 starting_pop ) And run it, you should see two phenomenon. The colors are not the pure RGB red, yellow, white, black, and green, but sometimes a muted blend (off-white, yellowish). Also, if you stop the program by changing the timer to '0' and look at the last string in the J terminal as an index to the colors you are seeing in the graphics output window (left to right, top to bottom), you will notice squares are black that should be white (a 1 should be white, not black. Black is 0). The second issue is that the display_infect function when called this way: infect_display^:25 starting_pop The way the original author intended, is to initialize the starting_pop and then run for 25 cycles (here days). But I have set it up inside the update function, so I think it is restarting it before the last call can finish within the timer interval. You should be able to track a square in its position, for example if the first square is black at some point (Dead), it should stay that way and in the same position. It doesn't. If you copy/paste the original author's code at the link I included in the original post, and run infect_display^:25 starting population, you will see the outputs, and they stay indexed correctly. Rob On Fri, 27 Mar 2020 at 23:18, 'Rob Hodgkinson' via Programming < [email protected]> wrote: > Good instruction, have saved and run as you describe below and reproduced > seeing changing graphics / colour blocks as you describe. > > I am unclear on the Legend for the colours and your issues described below… > > My issue is with the colors sometimes blending or white squares become > > black. This was more pronounced when I change the grid size to lower > > numbers like 64 people (8 8 $ infect_display^:64) vs. 144 people (12 12 $ > > ...). > > Also is the “broad description” of this code a step by step update on the > population changes ? (Ie is each box display of Susceptible | Exposed | > Infections | Recovered | Dead a “snapshot” of the population at each > iteration of this simulation ?) > > Can you elaborate a little further ? I have it running now, thanks, Rob > > > > On 28 Mar 2020, at 1:46 pm, Robert Herman <[email protected]> wrote: > > > > I am attaching it as a text file. Sorry about all the confusion. > > > > I am running J901 for Windows 64-bit. > > The animation is pulled from Michal's work. > > > > I press Ctrl-Shift-E to run the window once it is open in the J editor. > > > > A blank white graphics window should open. > > > > I then change the 0 in wd 'timer 0' to something like 650 and place my > > cursor on the end of the line and hit Ctrl-R. > > The terminal starts to show the output, and the graphics window starts > > animating with color blocks. > > > > Don't X out of the graphics window. It will crash your session. Instead > > change the 650 back to 0 and hit Ctrl-R to stop the program for a > graceful > > exit. > > > > My issue is with the colors sometimes blending or white squares become > > black. This was more pronounced when I change the grid size to lower > > numbers like 64 people (8 8 $ infect_display^:64) vs. 144 people (12 12 $ > > ...). > > > > Thanks. > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
