impactbyte-igneel / projects

🌐 Projects
https://gitlab.com/impactbyte/learn/course-fullstackweb?nav_source=navbar
The Unlicense
0 stars 0 forks source link

Coding Game #15

Open fadhilahade opened 5 years ago

fadhilahade commented 5 years ago

https://www.codingame.com/ide/puzzle/the-descent

haydanu commented 5 years ago
while (true) {
    let mountainHighest = 0;
    let mountainToShot = 0;
    for (let i = 0; i < 8; i++) {
        const mountainH = parseInt(readline()); // represents the height of one mountain.
        if(mountainHighest < mountainH){
           mountainHighest = mountainH
           mountainToShot = i}
    }

    // Write an action using console.log()
    // To debug: console.error('Debug messages...');

    console.log(mountainToShot); // The index of the mountain to fire on.
}