This is why I can't learn to code

Language of choice: Lazarus/Free Pascal

This whole thing is supposed to teach programming right? I’ve tried several times to learn simply because I have a creative desire to make games. I’ll decide on a language & then read docs & do tutorials until about the 4th chapter/lesson, whereupon “the learning curve” will abruptly right angle into a vertical, straight up-and-down wall/barrier to any further progress & I will become hopelessly confused and overwhelmed with frustration. The frustration is usually due, for example, to something like the authors attempting to elucidate a more challenging concept than prior material by using explanations consisting of words they haven’t bothered to previously define & which then turn out to be conspicuously omitted from the glossary - making comprehension (for me at least) slight, which in turn inhibits learning more advanced material that builds on it.

I know the basics: looping, conditional branching, what variables & pointers are, the dif between objects/classes/etc…if I have to read one more “Hello World” tutorial I’ll shoot myself (after a short murderous rampage on coding books authors). But making even a simple functional application - much less a game - is seemingly not even on the horizon for me.

I am at the moment experiencing something similar to what I described above right here & now with this site. The “shooting the closest enemy” thing was as easy & painless as a first challenge should be. But now the second one, “Descent,” instead of being slightly more difficult, is completely & utterly baffling.

The instructions say “At the start of each game turn you’re given the height of 8 mountains.”

  • Turn? Do they mean iterations of the For loop?
  • And uh, no. Nowhere in that block nor anywhere else in the code is anyone given anything resembling that information - which would seem to preclude any solution since you don’t have the necessary info.
  • Is this ALL of the program needed to create what’s happening in the left-hand frame? Surely not; where are the graphics, for one thing? That really bothers me. Everyone wants to show you snippets - and I think this is why I’m retarded as a programmer (aside from my casual & indifferent level of devotion to it), I certainly would benefit from seeing the whole thing in its entirety.

Sorry, I know it’s my fault but in my annoyance I find comfort faulting the designer. Anyone willing to help me out here?

Man, there is no easy way to learn. Regardless of whether you try to learn coding, painting or speaking in foreign language. I’ve been wondering trough the Internet for years in search for a place, when I could learn how to code. Now I know, there is no such place. You can find better or worst tutorials, but thats all. The rest is up too you. You need to sit down and write some app. You will either succeed or you will fall, but there is no other way.
If you want another good tutorial, try this: https://www.coursera.org/specializations/programming-unity-game-development
Codingame is just best at giving you puzzels to solve.
Referring to your “questions”:

  • One turn is the one iteration of the wile loop.
  • You need to figure out some things yourself from time to time :slight_smile:
  • The graphics is just something extra, there is plenty of puzzles with no graphics at all. And believe me, as a beginner, you would definitely not benefit form seeing the “whole thing”.
3 Likes

Hello and welcome to Codingame. Sorry you’re having trouble.

miaugust touched on it above me but I’ll reiterate… the best (and most would say the only) way to learn to program is… to program. Pick a small app, or function, or whatever, and just start. This site is full of such little projects in the form of puzzles, bots, and optimization challenges.

The main problem a lot of folks have is in figuring out how the interface works, and it sounds like you might be in that boat. First off, you are not responsible for the graphics. They are just there to show you visually what effect the answers given by your code are having.

At the heart of it, every puzzle boils down to this:

  1. Read stdin (input from the console, always text). This involves your language’s version of Console.ReadLine().
  2. Think (this is the code you write to come up with the answer)
  3. Print your response in the required format on stdout (output to the console, always text)

Items 1 and 3 are provided in the initial code that is given to you. What you have to do is write the code for item 2 and substitute the answer into the response.

Sometimes the puzzle/game involves multiple turns, in which case the steps above happen inside an infinite loop. Don’t worry about the infinite loop; the server ends the loop when it detects that you have reached an end state (i.e. it knows when you’ve won or lost and terminates the loop at that point).

Last thing (and this one tripped me up early on), scrolling down inside the graphics panel gives you a detailed problem description which includes formatting information and more detailed rules for the puzzle. In some puzzles this is not obvious.

1 Like

I believe you’re missing two points. The first one is about the type of programs that you have to write to have fun on CodinGame, , the second one, maybe more fundamental, is about what programming is.

On CodinGame you are supposed to write programs that control one or more objects and that lead to a desired state (the victory condition). Your tipical program flow looks like this: CG Loop. You can see there’s a loop from which you exit when you either win or lose. For each loop (a turn) you read from standard input (with readln in Pascal) the current state and you write on the standard output (with writeln in Pascal) something to modify the state of the game. If you didn’t win and didn’t lose, you go for another turn (loop).

Taking your example (“The Descent”), at each loop you read the heights of the mountains, decide which mountain you want to shoot at and write out the number of the mountain you choose.

That’s the program you need to write. What’s on the left upper panel is a nice graphical representation that is there to make everything more intersting and, also, to easily give you immediate feedback on what your program is doing.
You’re not expected to write the code to manage the graphical aspect of the game.


The second, more fundamental part I believe you’re missing it’s the essence of programming which is only loosely related to programming languages.

To write a program you have to go through the following stage:

  1. Understand the problem. Keeping “The Descent” as a rolling example, your problem is to land safely, but this is not all. To land safely, you need to avoid crashing into one of the mountains. And to avoid crashing in the mountains, the safest choice is, at each turn, to shoot at the highest mountain in the range. This is the problem you have to solve.

  2. Find a suitable representation for the problem and its solution. This usually means to decide for a set of variables (which will represent a set of data structures) and for an alghoritm that modifies those variables to achieve the desired result. For “The Descent”, we need to reperesent the height of the mountains, the height and the position of the highest mountain and use a simple simple algorithm like the following.

  3. Write the code. Now the programming language comes into play and you have to encode (for the benefit of the computer that will have to execute it) the representation of the problem and of the solution intro the language of your choice.

  4. Test the code. As nobody gets right at the first try. If results are not what you expect you may have missed something at point 1 (i.e. the problem is not what you imagined it to be), at point 2 (i.e. the representation you choose is not correct for either the problem or the solution) or at point 3 (i.e the code do not really encodes the representation of your solution). Just fix what needs to be fixed and repeat.

There is fun (and frustration) in each stage: it’s interesting to understand througly a problem, it’s enlightining to find a suitable solution, is satisfying to be able to code the solution as better as possible. And it’s really liberating when your tests confirm that everything is fine and you got it.

I hope you will enjoy programming as I do (or even more :slight_smile: )

6 Likes

OP is so true. The other comments are all bull shit. I firstly tried this site few months ago and had a same problem OP had.

The Descent is way too hard for a beginner to try out. A level with the same difficulty as this one comes out in the middle of the entire progress in another games. Do you staff here seriously believe the a total novice know anything about for-loop, iteration, and how to use it to make something out?

I managed to solve it because I had learned the basic from another good gaming websites. There is no easy way? The best way to learn it is to do it? This is what programming is? WELL I HAVE TO SAY THAT THERE IS A WAY AND THAT IS TO GET OUT OF THIS NOT IN A HELL BEGINNER FRIENDLY WEBSITE AND JUST TRY OTHERS.

1 Like

CodinGame never said that this is a place where you can learn how to code. In fact there’s absolutely no documentation on that.

It’s a place where you can learn new algorithms, new way of coding. But you have to already know how to code. If you don’t know how to code a for-loop, you are at the wrong place.

2 Likes

I personally found that the email sent to newcomers is pretty straightforward:

If you’re completely new to programming, even simple puzzles will be challenging. I suggest learning the basics of programming first, like String manipulation, arrays, conditionals and loops.

1 Like

Maybe you should suggest learning to read first.

6 Likes

Same problem as the OP. I understand the basics of programming but can’t understand your website. At least I am not alone. It seems almost half the people who try the first example are not successful. It a shame, because it sure looks fun. Best of luck to you and your website.

2 Likes

If by the first example you mean the Onboarding puzzle then there is the Hints button. Some easy puzzles (The Descent, Power of Thor ep.1) have it too, so you could deduce a lot about how CodinGame platform communicates with your code.

I’m curious to know what you didn’t understand or what blocked you @Meowser

I actually aggree with you, most sites present you with a prebuilt method expressing what inputs you will get. It takes a while to get used to how this site operates, which seems to be ReadLine.
I got a few covered, but only after testing the data coming in, you could spend a good hour deciphering the authors intentions and then after you have passed all the tests, you submit to find he has secret additions with no real explaination. For example the Temperatures puzzle has a test for single value, yet the author does not point this out, regardless my program submits that information, yet the testing feature wont aknowledge it. Luckily visual studio tells me in right even though this website is massivley faulty. I fear for those taking interview tests here, that can really mess with someones day.
Why are games fun, because they utilise a learning/skill curve, this site is full of authors flexing their muscles, its not fun to learn here even though the site is advertised as such, and before I get blowback for that, please look at the menu bar.

There is no secret. The puzzle has twice pointed out that N = 0 is allowed. N = 1 is obviously allowed too.

Display 0 (zero) if no temperatures are provided
0 ≤ N < 10000

Programmers tend to have false assumptions. This time your assumption overrode the statement.

Learn to read specifications is part of training in programming. Accept that if was your bad to miss the statement. Instead of blaming the statement is faulty, push yourself to restrain your assumptions and be more careful next time. You will improve overtime.

9 Likes

There’s a lot of asslicking on this website is insane…
it’s clear that is has so many flaws, but they don’t want to listen, just SWALLOW and adjust to their desire, which are probably pushed by some…

They clearly don’t care, otherwise they would have tones of tutorial on Youtube, but there’s almost none…

I think you just don’t understand the goal of this site. Sure there’s plenty to learn, but it’s not intended to teach you the basics of coding.

I could code before I got here, but not very well, but enough to pass the bar of entry.

Perhaps you do not yet pass the bar of entry and that means you need to learn elsewhere before you come here. Codingame is under no obligation to help you pass this bar.

If you do understand enough to get started, you can have a blast on this site. It’s truly unique. Other sites have puzzles and optimization challenges, but the amount of competitive bot arenas is staggering. Very cool stuff. Without some basic coding skills and ability to do computational thinking you will quickly get stuck though.

5 Likes

I totally agree with what @MSmits says. Also please refer to the FAQ on this forum https://www.codingame.com/forum/t/faq-really-frequently-asked-questions/409. I quote, in particular, the entry requirements stated in that post:

Consider learning the following the basic to succeed the first game:
• Variables
• Conditionnal Statement: IF, ELSE IF, ELSE
• Loop: WHILE, FOR
• Input/Output: read, print etc