Forum

Poll

12 Years of Skylanders, Have You Played Any?
View Results
Page 1 of 1
print "CAN YOU READ THIS?!" [CLOSED]
DS D Yellow Sparx Gems: 1565
#1 Posted: 01:37:02 19/09/2015 | Topic Creator
The following is Python code. It was part of homework that took me more than 2 hours to complete.

Code:
def next_bunny(bpop,fpop):
    bpop_next = (10*bpop)/(1+0.1*bpop) - 0.05*bpop*fpop
    return max(int(bpop_next), 0)

def next_fox(bpop,fpop):    
    fpop_next = 0.4 * fpop + 0.02 * fpop * bpop
    return max(int(fpop_next), 0)
    
bPOP = float(raw_input("Number of bunnies ==> "))
fPOP = float(raw_input("Number of foxes ==> "))

print "Year 1 : %d,%d " %(bPOP,fPOP)
print "Year 2 : %d,%d " %(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP))
print "Year 3 : %d,%d " %(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),        next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP)))
print "Year 4 : %d,%d " %(next_bunny(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP))),        next_fox(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP))))
print "Year 5 : %d,%d " %(next_bunny(next_bunny(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP))),        next_fox(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP)))),                                next_fox(next_bunny(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP))),        next_fox(next_bunny(next_bunny(bPOP,fPOP), next_fox(bPOP,fPOP)),next_fox(next_bunny(bPOP,fPOP),next_fox(bPOP,fPOP)))))

If you can read it and tell what it's supposed to do, then I'll go to your house and fistbump you on the shoulder, and I'll raise my hands in the air and say "HELL YEAH, MAN! YOU DID IT!"
---
Yo, DEADASS?? BANANAS ARE DEAD???

(Former admin of TapL's Server.)
Camo22 Emerald Sparx Gems: 3501
#2 Posted: 02:43:39 19/09/2015
Right, my guess is...

I'm seeing Bunny in lots of places and Year 1-5. Next_fox and next_bunny.

Is it something to do with the more bunny per year the more foxes increase? Then because of the extra foxes, the bunnys decrease but bunnys being able to breed quickly, increases in amount and thus the number of hungry foxes.
---
=Fixing Theories since Sep, 2015 / Deviant Art =
Muffin Man Platinum Sparx Gems: 5355
#3 Posted: 03:33:01 19/09/2015
Get your wizards magic out of here! You sorcerers and your strange ways have no place amongst us muggles.
---
Boop me if you see this.
Camo22 Emerald Sparx Gems: 3501
#4 Posted: 03:38:00 19/09/2015
Code is not magic. It's complicated logic.
---
=Fixing Theories since Sep, 2015 / Deviant Art =
Rin Blue Sparx Gems: 934
#5 Posted: 03:39:47 19/09/2015
Logic? What is that? 2+2=829! smilie
---
Gone.
Muffin Man Platinum Sparx Gems: 5355
#6 Posted: 04:02:28 19/09/2015
Quote: Camo22
Code is not magic. It's complicated logic.


*Splashes Camo with holy water*
---
Boop me if you see this.
Rin Blue Sparx Gems: 934
#7 Posted: 04:49:20 19/09/2015
Camo can do code. In a way he's like me. I can read a 30 chapter book in an hour. smilie
---
Gone.
Big Green Platinum Sparx Gems: 6345
#8 Posted: 05:16:57 19/09/2015
this is black magic and i think thats against the forum rules
Camo22 Emerald Sparx Gems: 3501
#9 Posted: 12:31:56 19/09/2015
Quote: Rin
Camo can do code. In a way he's like me. I can read a 30 chapter book in an hour. smilie


Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.

To post this comment is code. When ever you press any button on the top of the comment section, that's code. To load this comment requires code. Code is the lifeblood of cyberspace. Without it, there is no cyberspace. Internet, social media, smilie, all run on code.

I still don't know if i'm right yet but I have a hunch.
---
=Fixing Theories since Sep, 2015 / Deviant Art =
Edited 1 time - Last edited at 12:35:10 19/09/2015 by Camo22
Big Green Platinum Sparx Gems: 6345
#10 Posted: 16:24:32 19/09/2015
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


wow that's incredible
CommanderGame Emerald Sparx Gems: 3610
#11 Posted: 16:29:50 19/09/2015
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


what.
xXBeavcoonXx Gold Sparx Gems: 2628
#12 Posted: 00:34:49 20/09/2015
Quote: CommanderGame
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


what.


>can think outside the box and think very logically
>is proud of himself for figuring things out about rodent relationships
>can't spell compliment correctly
---
now its time to get funky
CommanderGame Emerald Sparx Gems: 3610
#13 Posted: 02:34:56 20/09/2015
Quote: xXBeavcoonXx
Quote: CommanderGame
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


what.


>can think outside the box and think very logically
>is proud of himself for figuring things out about rodent relationships
>can't spell compliment correctly


Look* outside the box
Camo22 Emerald Sparx Gems: 3501
#14 Posted: 04:29:23 20/09/2015
Quote: Big Green
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


wow that's incredible

Quote: CommanderGame
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


what.

Quote: xXBeavcoonXx
Quote: CommanderGame
Quote: Camo22
Thanks for the complement. I can't read code but I'm good at thinking logically and looking outside the box. Hell, I've figured out SonAmy hints that even the biggest SonAmy fans haven't found out yet.


what.


>can think outside the box and think very logically
>is proud of himself for figuring things out about rodent relationships
>can't spell compliment correctly


[User Posted Image]
-----
---
=Fixing Theories since Sep, 2015 / Deviant Art =
Big Green Platinum Sparx Gems: 6345
#15 Posted: 04:31:25 20/09/2015
i'm dead serious, please tell me the things you picked up on regarding sonamy because i ship it super hard and i want to gush over how cute desu they are together
Camo22 Emerald Sparx Gems: 3501
#16 Posted: 04:34:12 20/09/2015
Quote: Big Green
i'm dead serious, please tell me the things you picked up on regarding sonamy because i ship it super hard and i want to gush over how cute desu they are together


I'll PM you.
---
=Fixing Theories since Sep, 2015 / Deviant Art =
DS D Yellow Sparx Gems: 1565
#17 Posted: 08:26:38 24/09/2015 | Topic Creator
Quote: Camo22
Right, my guess is...

I'm seeing Bunny in lots of places and Year 1-5. Next_fox and next_bunny.

Is it something to do with the more bunny per year the more foxes increase? Then because of the extra foxes, the bunnys decrease but bunnys being able to breed quickly, increases in amount and thus the number of hungry foxes.



Well, at least you're getting some idea out of it. The code is input into an IDE, and then it first prints out the things in "raw_input()" that ask you to enter the population of the bunnies and foxes in a particular area. As soon as you enter both, the code uses those named functions, the things nesting inside the "def [whatever]():". The output values depend on what you decide to put for the initial bunny and fox populations. If you make the bunny count much lower than the fox count, for instance, there might be a case in which the bunny population would be completely wiped out by or even before year 5, which would definitely decrease the fox population in the coming years. But then if you make the bunny population high, the bunny population would surely decrease the first year, but the foxes won't reign over the bunnies.

Also, there will be cases that the bunny population will increase during the 2-3 year interval. Like I said, results vary on your input.
---
Yo, DEADASS?? BANANAS ARE DEAD???

(Former admin of TapL's Server.)
Edited 1 time - Last edited at 08:28:42 24/09/2015 by DS D
Dark Snap Shot Gold Sparx Gems: 2623
#18 Posted: 08:31:49 24/09/2015
Uhhhhh
21?
---
Psn-Zydren8cookie, FC 3024-5345-8692
Camo22 Emerald Sparx Gems: 3501
#19 Posted: 08:38:20 24/09/2015
Quote: DS D
Quote: Camo22
Right, my guess is...

I'm seeing Bunny in lots of places and Year 1-5. Next_fox and next_bunny.

Is it something to do with the more bunny per year the more foxes increase? Then because of the extra foxes, the bunnys decrease but bunnys being able to breed quickly, increases in amount and thus the number of hungry foxes.



Well, at least you're getting some idea out of it. The code is input into an IDE, and then it first prints out the things in "raw_input()" that ask you to enter the population of the bunnies and foxes in a particular area. As soon as you enter both, the code uses those named functions, the things nesting inside the "def [whatever]():". The output values depend on what you decide to put for the initial bunny and fox populations. If you make the bunny count much lower than the fox count, for instance, there might be a case in which the bunny population would be completely wiped out by or even before year 5, which would definitely decrease the fox population in the coming years. But then if you make the bunny population high, the bunny population would surely decrease the first year, but the foxes won't reign over the bunnies.

Also, there will be cases that the bunny population will increase during the 2-3 year interval. Like I said, results vary on your input.


Ahh, now I see it. I don't type code, but apparently in my IT class, I can read bits of it.
---
=Fixing Theories since Sep, 2015 / Deviant Art =
Page 1 of 1

Please login or register a forum account to post a message.

Username Password Remember Me