Non-moving male mountain lion

Posted March 28, 2017 by sircollins88

Hello, 

My 7th grade students are working on simulating competition between species within an ecosystem.  One group has decided to model sexual reproduction with two mountain lions. However, their male mountain lion will not move.  They have rebuilt the entire male mountain lion setup, still with no luck.  Any help would be greatly appreciated. 

http://www.slnova.org/hugohugo317/projects/435339/ 

Comments

Submitted by ilee on Tue, 03/28/2017 - 13:51 · Permalink

Hello Kevin Collins (sircollins88),

Your subject line is a real attention-getter!

Here are two different versions I played with:

Using procedures, lion only takes one step each time forever is toggled on.
http://www.slnova.org/ilee/projects/443197/
 
Then removed blocks from procedures and put them directly in forever, now it works
http://www.slnova.org/ilee/projects/443681/
 
I'm sending this off to Daniel to see if he has any ideas on why this behavior is happening.   I'll ask him to post the reply here....
--Irene
 
 

Irene, 

Thank you for your incredibly quick and helpful response, needless to say the boys will be extremely excited and relieved that their simulation is working as expected (they need to work on the repro of the lions). 

I have some other groups that are facing similar situations, using procedures, we will model some fixes off of your response.  

If we continue to have difficulties would it be possible to contact you directly, not through the GUTS forum? 

I am working with a group of 7th grade students at the International School of Düsseldorf, and they are very keen to continue to develop and refine their models. 

K

Hi Kevin,

I hope it isn't too much to ask to post these questions here on the forum.  It really will help others who run into the same issues.  So, please, continue to contact me through the forum. 

For example, in this case, I did the following to isolate and fix the problem:

1) I saw a list of "procedure calls" using the call block in the forever loop.  I pulled them all out then added them back in one by one.  This made me realize that the 1st call block was working but the others were not.

2) I left the first and second call blocks in and dug deeper into why the second call block was not working, I played around with the blocks checking that all the linking was good and all the parameters (typed in values) were working.  Then tried the running the model again.  No luck.

3) then I went to see if there was something wrong with the conditional statement itself. Would a male lion run about if none of the rabbits ever got close enough? Rabbits were running when they were 12 away from a lion but a lion was chasing when a rabbit was 8 away.  The code looked okay, I even tried lion chasing at 12 away.

4) then I wanted to see if the energy of the lion was being changed correctly whenever the lion moved. I created a databox with that displayed the male lion's energy (and only made 1 lion in setup).

5) finally I thought every thing looked okay so I wondered if it could be something going wrong with the procedures.  This is when I unraveled the procedures and put the code directly in the forever loop.  Now the lion was running and chasing

BUT I still don't know what is wrong with the procedures or how they were being used.   I am hoping to get some insight from the developers.

--Irene

Submitted by sircollins88 on Tue, 03/28/2017 - 16:52 · Permalink

Sure no problem posting to the forum.  Thank you for outlining your thought process, this will help the students to reflect upon their own troubleshooting.  

As soon as we have more questions, we'll be back. 

K

Submitted by Daniel Wendel on Tue, 03/28/2017 - 22:00 · Permalink

Wow, this was really hard to figure out and uncovered a very strange bug in StarLogo Nova! There are actually two problems here:

1) The "call Lion Death" call block is somehow not finding the Lion Death procedure; I think it's looking for "Lion Death " (notice trailing space). Re-select the correct procedure in the drop-down to fix that.

2) This is the really weird one! The if-else block is breaking the procedures! Going straight from the "else" to the end of the procedure is confusing it, and it is getting stuck never returning (which is why nothing after that procedure runs correctly). This is a bug in the engine or compiler. Luckily the new version of StarLogo Nova that is coming out this summer has a completely new engine and compiler, and this particular bug is gone. In the meantime, you can add "forward .000001" after the if-else block and before the end of the procedure, and that will make everything work as expected.

Thanks for the bug report!

Submitted by ilee on Wed, 03/29/2017 - 08:13 · Permalink

Thanks for chasing this issue down, Daniel!

Submitted by sircollins88 on Wed, 03/29/2017 - 09:52 · Permalink

Daniel and Irene, Thank you both for the help, the kids have retooled their models and all seem to be working again.  Looking forward to this summer's updates.

Kevin