Skip to content

Instantly share code, notes, and snippets.

@Rishav159
Last active June 2, 2017 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rishav159/9bb07225a5f57ff0720b9cd7cbbb7209 to your computer and use it in GitHub Desktop.
Save Rishav159/9bb07225a5f57ff0720b9cd7cbbb7209 to your computer and use it in GitHub Desktop.
f(i) {
return 1 + Math.sin(0.1 + (i * 0.7) * Math.cos(9 + i*0.3))
}
generateRandomHill() {
let states = [];
let x = Math.random()*(30-5)+20;
let y = Math.random()*(100)
for(let i = 0; i < 100; i++) {
states.push(Math.floor(this.f(i/x + y)*(100-5) + 5))
}
return states;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment