Kirk's Quest - The Descent - puzzle discussion (old)

Felt very straightforward to me, only checked the discussion to see if anyone else did it how I did. Basically I checked which mountain was the tallest and only fired when my ship was on top of it. Sounds a lot simpler than what others tried to do here.

Didn’t need to do anything special after that, since it seems like you don’t explode or anything if you attempt to fire twice in a single pass.

Ain’t this supposed to work ?`

EDIT CvxFous: no full code, and above all, no “can you fix it for me?”, this site is about learning code and practising your AI, if you have trouble, ask for help detailling what you did. Copy-paste and then waiting for someone to drop the answer for you isn’t how you’ll learn.

Please consider reading FAQ of most common questions

This can be solved without using SY at all :wink:

2 Likes

Hi,hope you are all doing well
I wrote the code below which doesn’t work,I’m here to understand why
Please reply in simple english so i will be able to understand
If possible reply in french
Thank you in advance
 
EDIT: No full code please

Le problème est ta dernière boucle for qui écrit 8 instructions par tour de jeu au lieu d’une seule.

@forlan3 Pas de code complet s’il te plait, le code ne doit être utilisé qu’en dernier recours afin d’expliquer une notion obscure.

Il faut suivre quelques principe assez simple que tu peux retrouver sur stackoverflow:

  • Chercher avant de poser une question
  • Rechercher
  • Si tu est toujours bloqué, explique ce que tu as fait, ce que ça a donné, ce que tu attendait.
  • Et seulement après si nécéssaire, illustre avec du code.

Bref, coller son code complet et dire “Au secours je ne sais pas faire”, ça ne prouve pas que tu as fait des recherches, que tu as localisé ton problème ou que tu y as consacré du temps.

De plus là ton code est court, mais demander aux autres de cherche dans tout ton code ce que tu as fait de mal sans aucune autre indication est très mauvais.

Enfin bon, @NewboO a été gentil de te répondre cette fois ci, essaye de faire un effort de forme la prochaine fois.

Merci beaucoup @NewboO ,je vais essayer de resoudre le probleme et je vous tiens au courant.

@CvxFous C’est compris.Merci.

I found this understanding problem too. Finished with C#
Cool thing when you get the grips though.

Hi, I’m trying it with Python 3 but I don’t understand anything. As soon as I read the story, I came up with some solutions but wrote so just for the first check:

if SX == 2: 
    print('FIRE')

I wrote this anywhere (I mean under the for loop, the while loop, or outside of the while loop) in the code but it returned an error says “your program did not write ‘HOLD’ or ‘FIRE’ in due time.” and they didn’t shoot anyway :confused:

Did you keep the while 1: loop?

try this :smiley:

Edit : No Full Code Allowed

Ahem… Broum broum…

I tried to solve this problem for 2 hours then i realized i haven’t read correctly how it works then i solved in 5 minutes :D.

1 Like

Whats the ‘i’ variable in: for (int i = 0; i < 8; i++)?

its the only place it apears. I coding in C.(just started learning).

Thanks!

It a variable used through the for-loop, starting to 0 (i =0), while i < 8 (the number of mountains), each loop will add i + 1 (i++, next mountain).

I am having problems with creating an array with MH. Im trying to make my code show all montain highs as an array. I tryed like this, but some random numbers apears:

for (int i = 0; i < 8; i++) {
int MH[8];
scanf("%d", MH);
fprintf(stderr, “Debug messages…%d %d %d %d %d %d %d %d\n”, MH[0], MH[1], MH[2], MH[3], MH[4], MH[5], MH[6], MH[7]);

and i get this console output:

Debug messages…2 32767 0 0 4196224 0 4195792 0
Debug messages…1 32767 0 0 4196224 0 4195792 0
Debug messages…2 32767 0 0 4196224 0 4195792 0
Debug messages…1 32767 0 0 4196224 0 4195792 0
Debug messages…2 32767 0 0 4196224 0 4195792 0
Debug messages…1 32767 0 0 4196224 0 4195792 0
Debug messages…2 32767 0 0 4196224 0 4195792 0
Debug messages…1 32767 0 0 4196224 0 4195792 0

(this is the output in test case 4 = all montains)

if someone can send some light to my way, or say something that puts me in the right direction, ill be very greatful. Im learning C while im playing this games. I already complete games 1, 2 and 4 without much problem.

Hi,

You have to initialize your array outside the loop.
With your solution, you created 8 arrays (one per loop) and populated only the first item, that’s why the others are random, they are not initialized to 0 by default.

 int MH[8];
    for (int i = 0; i < 8; i++) {
        scanf("%d", &MH[i]);
        fprintf(stderr, "Debug messages...%d", MH[i]);
    }

Console :
Debug messages…2
Debug messages…1
Debug messages…2
Debug messages…1
Debug messages…2
Debug messages…1
Debug messages…2
Debug messages…1

1 Like

Thank you very much, i didnt solve it all yet, but now i just have to work on the logic part. I can pass all tests already, just not all at the same time. Now is the part the part that i realy have fun with. Thank you. :smiley:

EDITED: solved!

1 Like

So i have been trying to solve this puzzle by the position of S i dont get how people are using the height of the mt that would make things so much easier but i dont get how to assign ea MH to ea Mountain?