This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Infect

Return to Infect

A new version of this scenario was uploaded on Sat Jun 11 21:45:21 UTC 2011
kiarockskiarocks

2011/6/11

Special Thanks to danpost for the code help!
A new version of this scenario was uploaded on Sat Jun 11 22:07:03 UTC 2011 made it smaller for easy viewing
danpostdanpost

2011/6/11

Edit your scenario -- put in a description: What is does or demonstrates. What to look for that indicates state of Actors (when infected; what turned image means, etc.
kiarockskiarocks

2011/6/11

^it died^
A new version of this scenario was uploaded on Sat Jun 11 22:17:21 UTC 2011
kiarockskiarocks

2011/6/11

ok, dan, how do i fix it looking like a gray screen with a box in the center
danpostdanpost

2011/6/11

What does your code in 'theWorld' look like?
kiarockskiarocks

2011/6/11

import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class InfectWorld here. * * @author (your name) * @version (a version number or a date) */ public class InfectWorld extends World { /** * Constructor for objects of class InfectWorld. * */ public InfectWorld() { super(15, 13, 60); prepare(); } { Greenfoot.setSpeed(25); } /** * Prepare the world for the start of the program. That is: create the initial * objects and add them to the world. */ private void prepare() { Rock rock = new Rock(); addObject(rock, 5, 4); Rock rock2 = new Rock(); addObject(rock2, 8, 5); Rock rock3 = new Rock(); addObject(rock3, 5, 8); Rock rock4 = new Rock(); addObject(rock4, 2, 9); Rock rock5 = new Rock(); addObject(rock5, 9, 9); Rock rock6 = new Rock(); addObject(rock6, 10, 6); Rock rock7 = new Rock(); addObject(rock7, 7, 3); UnInfected uninfected = new UnInfected(); addObject(uninfected, 4, 6); UnInfected uninfected2 = new UnInfected(); addObject(uninfected2, 7, 6); UnInfected uninfected3 = new UnInfected(); addObject(uninfected3, 6, 9); UnInfected uninfected4 = new UnInfected(); addObject(uninfected4, 8, 10); UnInfected uninfected5 = new UnInfected(); addObject(uninfected5, 11, 10); UnInfected uninfected6 = new UnInfected(); addObject(uninfected6, 12, 6); UnInfected uninfected7 = new UnInfected(); addObject(uninfected7, 10, 4); UnInfected uninfected8 = new UnInfected(); addObject(uninfected8, 5, 2); InfectLv1 infectlv1 = new InfectLv1(); addObject(infectlv1, 11, 1); InfectLv2 infectlv2 = new InfectLv2(); addObject(infectlv2, 13, 3); UnInfected uninfected9 = new UnInfected(); addObject(uninfected9, 9, 2); UnInfected uninfected10 = new UnInfected(); addObject(uninfected10, 7, 1); UnInfected uninfected11 = new UnInfected(); addObject(uninfected11, 4, 1); UnInfected uninfected12 = new UnInfected(); addObject(uninfected12, 3, 1); UnInfected uninfected13 = new UnInfected(); addObject(uninfected13, 1, 3); UnInfected uninfected14 = new UnInfected(); addObject(uninfected14, 1, 5); UnInfected uninfected15 = new UnInfected(); addObject(uninfected15, 2, 6); UnInfected uninfected16 = new UnInfected(); addObject(uninfected16, 3, 8); UnInfected uninfected17 = new UnInfected(); addObject(uninfected17, 4, 9); UnInfected uninfected18 = new UnInfected(); addObject(uninfected18, 5, 9); UnInfected uninfected19 = new UnInfected(); addObject(uninfected19, 6, 7); UnInfected uninfected20 = new UnInfected(); addObject(uninfected20, 4, 6); UnInfected uninfected21 = new UnInfected(); addObject(uninfected21, 4, 5); UnInfected uninfected22 = new UnInfected(); addObject(uninfected22, 3, 5); UnInfected uninfected23 = new UnInfected(); addObject(uninfected23, 2, 4); UnInfected uninfected24 = new UnInfected(); addObject(uninfected24, 2, 3); UnInfected uninfected25 = new UnInfected(); addObject(uninfected25, 2, 2); UnInfected uninfected26 = new UnInfected(); addObject(uninfected26, 1, 2); UnInfected uninfected27 = new UnInfected(); addObject(uninfected27, 1, 3); UnInfected uninfected28 = new UnInfected(); addObject(uninfected28, 0, 5); UnInfected uninfected29 = new UnInfected(); addObject(uninfected29, 0, 6); UnInfected uninfected30 = new UnInfected(); addObject(uninfected30, 0, 9); UnInfected uninfected31 = new UnInfected(); addObject(uninfected31, 0, 10); UnInfected uninfected32 = new UnInfected(); addObject(uninfected32, 3, 10); UnInfected uninfected33 = new UnInfected(); addObject(uninfected33, 5, 11); UnInfected uninfected34 = new UnInfected(); addObject(uninfected34, 6, 11); UnInfected uninfected35 = new UnInfected(); addObject(uninfected35, 6, 11); UnInfected uninfected36 = new UnInfected(); addObject(uninfected36, 6, 11); } }
A new version of this scenario was uploaded on Sat Jun 11 23:24:37 UTC 2011 Changed 15X13 to be 15X15
danpostdanpost

2011/6/11

First, get rid of the two brackets between 'prepare();' and 'Greenfoot.setSpeed(25);'. Next, assign an image to the 'InfectWorld' class (even if it a blank image). NOTE: Would it not have been easier to use a for loop as such: for (int uninf = 0; uninf < 36; uninf++) { int myX = Greenfoot.getRandomNumber(15); int myY= Greenfoot.getRandomNumber(13); UnInfected uninfected = new UnInfected(); addObject(uninfected, myX, myY); } This would add all your UnInfecteds!
kiarockskiarocks

2011/6/11

thanks, ill see if it works
danpostdanpost

2011/6/11

We really should be 'discussing' in 'DISCUSS', instead of where commentary on Infect should be. I'll start a discussion named 'On fixing Infect' -- let us discuss there.
kiarockskiarocks

2011/6/11

danpost, identifier expected for the setspeed
A new version of this scenario was uploaded on Sun Jun 12 16:31:03 UTC 2011
danpostdanpost

2011/6/12

Looks pretty good right now -- I wouldn't mind looking at the code. Maybe I could give some pointers.
A new version of this scenario was uploaded on Mon Jun 13 14:17:17 UTC 2011 Speical verison for danpost to see what happens at 20 pixel cell size
danpostdanpost

2011/6/13

The code is not available!
A new version of this scenario was uploaded on Tue Jun 14 00:43:31 UTC 2011
kiarockskiarocks

2011/6/14

my bad!
danpostdanpost

2011/6/14

Look in DISCUSS -- discussion titled 'On fixing "Infect"' -- try the changes I suggested.
A new version of this scenario was uploaded on Tue Jun 14 01:22:22 UTC 2011
A new version of this scenario was uploaded on Fri Jun 17 14:21:56 UTC 2011 WAYYY Awesomer
A new version of this scenario was uploaded on Fri Jun 17 14:38:00 UTC 2011
danpostdanpost

2011/6/17

Mik suggested having the people procreate and age and see what rate of infection would kill off the population. I say that is a good idea! Use the scale() method to 'grow' the images; with a variable to keep track of the age of the person. You could use this variable to adjust the chance of infection (the young are less likely to catch the infection). Also, the age could be used to make the un-infected die off even when not infected (chance of dying increases as age increases).
A new version of this scenario was uploaded on Tue Jun 28 03:33:55 UTC 2011