The Descent - Puzzle discussion


#234

Hello,

I get the following error : "Invalid command sent. It should be an integer from 0 to 7."

My code in Scala :

while(true) {
    val listMountainHigh = scala.collection.mutable.ListBuffer.empty[Int]
    for(i <- 0 until 8) {
        val mountainh = readInt
        listMountainHigh += mountainh
    }
    println(listMountainHigh.max)
}

Other solution I tried :

while(true) {
    val listMountainHigh =  for(i <- 0 until 8) yield readInt
    println(listMountainHigh.max)
}

I find 9 for the max high so why the error message include only 0 to 7 ?

Thanks


#235

You have to print the index of the highest mountain, not it's height.


#236

Oh, that's right ! :sweat_smile:
So there is no problem.
Thank you !


#237

Help , what I need to write on javascript ?


#238

hello, I'm having some issues with this puzzle for some reason its giving me an error saying that the closing bracket for the class declaration is unexpected here's my code:

using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;

/**
 * The while loop represents the game.
 * Each iteration represents a turn of the game
 * where you are given inputs (the heights of the mountains)
 * and where you have to print an output (the index of the mountain to fire on)
 * The inputs you are given are automatically updated according to your last actions.
 **/
class Player
{
    static void Main(string[] args)
    {
        var hMax = 0;
        var iMax = 0;
        // game loop
        while (true)
        {
            
            for (int i = 0; i < 7; i++)
            {
                int mountainH = int.Parse(Console.ReadLine()); // represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right.
                if (mountainH > max) 
                {
                    hMax = mountainH;
                    imax = i;
                {
                    
            };

            // Write an action using Console.WriteLine()
            
            // To debug: Console.Error.WriteLine("Debug messages...");

             // The index of the mountain to fire on.
        }
    }
}

#239

Check that for each opening bracket, you've got a closing bracket


#240

this really is incredibly poorly explained. back to codewars for me...


#241

Hi, just wanna share the code in Python 3 language:

admin edit: don't share full code


#242

I completely agree, what a mess this is on my screen. Four separate tabs all with very little explanation. To top it off they just drop you right in and expect you to know everything. This is a heaping pile of trash.


#244

import sys
import math
while 1:
def numbers(x):
for i in range(x):
if i < 9:
i += 1
yield i
print(list(numbers(11)))

I have used a generator why it constantly display “Timeout: your program did not write to the standard output in due time.” pls help


#246

It’s all unclear and confusing to me. This is not for beginners.


#247

Has any-one responded to this quite reasonable request? There are some of us who do not come to this knowing what we are here to learn!


#248

Why is it forbidden to post code? I took a MOOG course for Python, and it also would not let us post code; so i never could finish the course since I got stuck on one problem and was barred from going further. Is this some Python religious thing?


#249

What?
It’s not forbidden, just write the interesting part of your code.


#250

That’s why I thought it was forbidden. So, is it that we can share lines of code but not a ccomplete solution?


#251

You can share lines of buggy codes here; the validated code is readable by people who solved the puzzle in the same language.


#252

Well, i got some trouble to solve this one when i find codingame.

Still have some trouble, mostly because of the description of the puzzle.

Regards


#253

How do you do the code?i
I need help!


#255

Hey Im new to coding and would like some help on where to start, I’m working in JavaScript and understand the patterns of the heights of the mountains,
I’m unsure of how to link all the combinations into code so that the game works,
A reply would be very appreciated :slight_smile:


#256

i need help guys, i have no idea how to start coding in C