Simulating Life

Just another UMass Boston Blogs site

3/10 Code Review

| 1 Comment

I added an age timer to my ticks and tick eggs.
The code is supposed to add 1 “age time” to ticks while it is not attached to a deer and 1 “age time” to tick eggs.

First code = Tick Eggs

  • right before my tick eggs hatch, they have a 50% chance of dying due to malnutrition/starvation.

Question: Is my hatching code correct if I want the tick eggs to have a 50% chance of hatching(after 100 “age”)?

 

Second code = Ticks

  • if tick isn’t pregnant (aka attached to deer) then after 200 “age” they’ll die.
  • I also just noticed that I can just use “delete” instead of “delete agent, me.” I used “delete” under my tick eggs codes.

One Comment

  1. comments:
    left code:
    – the tick age = tick age + 1 is OK
    – the way you have it, if tick age > 100 there’s a 50% chance of making a tick AND THEN DELETING THE TICK YOU JUST CREATED! (move the delete out of the if/then)
    – if your age is > 99, there’s a 50% chance of the egg deleting itself – I don’t think this is what you want – delete this

    right code
    aok – you can just “delete”; you don’t need delete agent me – but you noticed that

Leave a Reply

Required fields are marked *.


Skip to toolbar