Skip to content

Instantly share code, notes, and snippets.

@AnnemarieWegley
Created June 11, 2014 16:02
Show Gist options
  • Save AnnemarieWegley/d4195cd1220b119d64a9 to your computer and use it in GitHub Desktop.
Save AnnemarieWegley/d4195cd1220b119d64a9 to your computer and use it in GitHub Desktop.
<script>
var owl, cat;
owl= alert("Guess who will the tootsie pop contest, Owl or Cat?");
function Animal(name, speed, focus, min){
this.name= name;
this.speed=speed;
this.position=0;
this.focus= focus;
this.run= function(){
if(Math.random() *10 < this.focus) {
this.position= this.position + this.speed;
}
}
}
owl= new Animal("Suzzie", 1, 10);
cat= new Animal("Kodi", 4, 2);
min=20;
while (owl.position <min && cat < min){
owl.run();
cat.run();
console.log(owl.name + " : " + owl.postition + " , " cat.name + " : " + cat.postition);
}
</script>
@PlenipotentSS
Copy link

I forked this gist, to give you an idea of what to look for:

https://gist.github.com/PlenipotentSS/9200f558f8320a1c1c84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment