Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding Game #15

Open
fadhilahade opened this issue Jun 25, 2019 · 1 comment
Open

Coding Game #15

fadhilahade opened this issue Jun 25, 2019 · 1 comment

Comments

@fadhilahade
Copy link

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

@haydanu
Copy link

haydanu commented Jun 26, 2019

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.
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants