Imposter syndrome hits hard. The "simple" Snake game is humbling me.
Posted by DiligentBathroom9282@reddit | learnprogramming | View on Reddit | 81 comments
After spending time mastering difficult concepts like OOP (constructors, decorators, encapsulation, etc.), I figured I'd test my skills on a classic 'simple' beginner project: a console-based Snake game. Now that I'm trying to build it, I'm having a surprisingly tough time. Is this normal, or does it mean I'm not suited for programming?
Have you experienced it? I am learning programming (as a hobby) for about a decade.
chrisrrawr@reddit
this isnt imposter syndrome. you genuinely dont know how to do what you are trying to do. you are learning. it's normal to be confused, feel lost, and struggle when you are learning, especially when you have underestimated the difficulty of what you are trying to do.
break the game down further. use a whiteboard or draw.io and literally break it apart. behaviors, states, generators, controls, objects, etc.
dont limit yourself. OOP is a tool, but if something is limiting you or stopping you from achieving your goals, it's okay to reach beyond it.
digicrat@reddit
Exactly.
One mistake I see people often make is in languages that are lenient to mixing OOP with non-OOP tech iqies in particular, people often focus on making everything an object, even when it has no benefit but to complicate things.
More on topic, when I was in college I took on a similar project trying to create a Tetris like game. That also turned out to be a lot more complex than I expected, but I learned a lot, especially when I asked my professor for advice.
One of the most important things to learn is to recognize when to ask for help. Often if you are stuck on something it is because there is a simpler approach you've never heard of before. A good mentor will help keep you on the right track and point out when there is a better approach you should research, or encourage you to keep working through it on your own when you are needlessly doubting yourself. That's all the fun of learning - and learning never ends (you just get wiser at recognizing what you dont know).
Raioc2436@reddit
The pain of thinking of yourself as a fraud because “you should know this by now” is often a good motivator to get up and learn it.
But you gotta be nice and fair to yourself as well. Don’t beat yourself too much when you come across something you don’t know yet. Accept that learning what you don’t know is the first step towards learning it.
code_tutor@reddit
I wrote snake when I was 15. OOP is also a first semester course and sometimes taught in high school now. Sorry, you're an imposter. It's not a syndrome.
This isn't to discourage you but you need to take a course like CS50 a few years of other courses before ready to be a junior.
TiredOfMakingThese@reddit
A lot of Knowledge in programming is domain specific. I know people whose “meta” skill set is problem solving and they seem to have the most ease with solving novel problems. But learning something new in an area you’ve never touched before is going to be challenging for most people, including plenty of skilled programmers. It seems to me to be more rare that people can look any any problem and figure it out quickly, but I am also a web developer so a lot of the domain here is knowing which APIs are available for ferrying data from a client to a server and vice versa.
MerlinDaWizzard@reddit
Imagine that but with 7 years of working experience... Yeah its me.
scmkr@reddit
Or 25, with your boss literally telling you that you are the top performer by every metric they measure, and now you’re thinking up some conspiracy theory about why they are lying to you …
ThomasPopp@reddit
You look them in the face and say oh you think this stuff can replace me? There are levels to this and I promise you that you will fail if I step out of this position.
Maybe you won’t fail. But you will lose a LOT of money when I stop helping fix your mistakes.
Grab-Born@reddit
Why did you make this comment so negative?
ThomasPopp@reddit
Because you are explaining an ignorant leader that has and sees no value in you in the way you describe. If they are itchy to replace you the moment a bot MIGHT be able to? a lot of the times these CEOs are very ignorant and don’t realize what you actually do. Reminding them that you are there when they fail has actually helped me before. I have even raised my rates and they still came back. When you are a professional in your field you can stand up for yourself. If they don’t come back I don’t care because they had no worth for me anyways. And if they do, guess what? You learned your lesson once and twice because my rate went up because NOW you see my value!
Grab-Born@reddit
I didn’t say anything
scmkr@reddit
I think you misunderstood what imposter syndrome actually is.
This is not a situation where your boss is downplaying anything, in fact, for it to be imposter syndrome, your boss (or someone) needs to be telling you that you’re awesome, but you don’t yourself believe it.
Why would someone do this? Why would they hear their boss telling them they are good and simply not believe it? Hell if I know. Unfortunately, even knowing it’s happening, even being fully aware, doesn’t seem to change it at all.
ThomasPopp@reddit
You simply haven’t worked in filmmaking. lol 😂
scmkr@reddit
We aren’t talking about filmmaking. What planet are you on, man?
PiersPlays@reddit
Quick question: have you read this comment?
https://www.reddit.com/r/learnprogramming/s/EYKvtrjdmI
gears123@reddit
10 here. Every time I have a prod issue I can't solve in a day, I get incredibly depressed and paranoid I'm going to be fired. This feeling never ends.
DiligentBathroom9282@reddit (OP)
but when you overcome it and finish your project.. Such a satisfaction
cmockett@reddit
9.5! 🙏
InVultusSolis@reddit
Building a whole-ass game is much more challenging than most programming you do for money. Most jobs where you program for money are to build out a small feature that uses mostly text in the pipeline and solves some kind of business need.
exajam@reddit
That's why OOP use should be marginal. Data structures are more important. Imperative and functional paradigms are as useful as (if not more than) object, depending on the project.
DiligentBathroom9282@reddit (OP)
Well IMO it's crazy good in good experienced hands. Elegant and beautiful
peterlinddk@reddit
It isn't imposter syndrome, it is mistaking not knowing the required logic/data structure with not knowing how to program it.
Everyone misunderstands Snake, and think that the head changes position, and drags the tail with it - it isn't! Here's how you should think about it: The snake is a queue!
Everytime it moves, a new position is added to one end of the queue (that is the head) and the last position in the queue is removed from the queue (that is the end of the tail). Except when eating something, the tail is not removed. So you don't change the position of the head, you "add" a new head in front of the snake, depending on the direction it is moving.
Use an actual Queue data structure if you can - that makes everything easier. And if not, then at least abstract the queue for the snake-body, so you don't have to worry about the array-index of head and or tail when building the game.
Hope that helps - good luck with coding it now!
DiligentBathroom9282@reddit (OP)
I did it :P It finally works. You were right, the issue actually was in queue logic (with old-new coordinates update to be precise. First segment got coordinates from player's (head) class old coordinates. And it worked. But others got their coordinates from their previous segment, which got their coordinates from player.. so they spawned inside each other :D. It works perfectly now! Looks not so perfectly tho.. :D
healeyd@reddit
Yep, if you time it right it reads as the tail extending into the same place as the new “head” moves forward.
peterlinddk@reddit
It is not a matter of timing, it is a matter of separating Model and View - the model, the array that keeps the segments of the snake, is a queue, and every "tick", every time the snake moves, a new head is added to the queue, and the tail-end is removed - unless the head eats something.
After updating the model, the entire snake is re-displayed on the screen, from head to tail. It isn't a matter of only updating the ends, that will cause problems.
healeyd@reddit
Yes, I think you misunderstood my point.
ScumbagLoneOne@reddit
Honestly from what I’m hearing, delete the code forget OOP and just write the code again procedurally. OOP is such a bunch of bs to think about that people new to it abuse to make easy problems very hard. Forget it. Think about what are the small things that need to happen and write them in functions only. You don’t even need to think about classes at that point. (Obviously class as a container would be nice at some point, but just skip that, it you want to add it add it in refactoring after the product is done)
ScarySai@reddit
College is stupid with this. You're essentially expected to know before you walk in.
This is normal, keep cracking at it.
com2kid@reddit
Almost 20 years of experience, I hold multiple patents, I worked on compilers, the .netmf runtime, embedded OSs, and lots of other gnarly stuff.
First time I tried game dev my head just about exploded. All needed design patterns are so different, my first attempt using my usual approaches sucked so hard.
Doing new stuff is supposed to be here, that is how you know you're learning!
ha1zum@reddit
2D graphics and OOP is not related to each other.
Pale_Height_1251@reddit
Snake is not an easy game to write. It's like a lot of supposedly basic games like Pong, or Breakout, they look so primitive but are surprisingly hard to write.
Just keep going and you'll get there, but make no mistake, Snake isn't easy.
sessamekesh@reddit
"Snake" was the first programming project I did that gave me a real challenge. It's a simple game but deceptively hard to write, I remember it being basically unplayable for me until I did something with ring buffers which is a decently advanced concept.
That all said I also was doing that during my second CS class. It's a challenge for a student for sure but I wouldn't call it advanced either.
elperroborrachotoo@reddit
Yes. You've been shown the tool box. You've held a hammer in your hand and taken a few swings. You've marveled at the ingenuity of torx. The saw with those many teeth was scary!
Now build a bird feeder.
You have to learn another thing: how to understand, transform and ultimately break down a problem so that it fits the tools you have. This is something that we don't know how to teach, and that's why it is important to do
jpgirlyn@reddit
You're doing the right thing, which is to struggle with something to learn.
I think this job (and most, actually) require a lot of humbling for one to be a pro. Good luck!
Puzzleheaded-Eye6596@reddit
Are you doing java? Use a console UI library like https://github.com/mabe02/lanterna?tab=readme-ov-file
DiligentBathroom9282@reddit (OP)
oh. Forgot to mention. For this project I use C#
Puzzleheaded-Eye6596@reddit
Well don't try to 'paint the screen' and deal with console sizes yourself. Look for a c# library that does all the low level coding for you. Some searches may be 'c# jcurses console UI library' or something
Then you can focus on the logic of your game
DiligentBathroom9282@reddit (OP)
Oh. I've handled console stuff. It's working fine. My main issue is tail logic (to be precise I am now lost in combo of tail logic and OOP structure for it)
Puzzleheaded-Eye6596@reddit
Deconstruct. A snake has an ordered collection of 'pieces' which have an x,y coordinate. Every time the snake moves just redraw the entire screen based on the x,y of your pieces and determine if an event happens
1) The snake eats a piece and grows
2) The snake hits the endge of the board which ends the game
3) the snake hits itself
Listen for up left right or down key strokes and reposition all the pieces and perform the event testing logic above and repaint the screen
Ratatoski@reddit
Spontaneous feel is that the tail should be an array of coordinates. Then every movement you add the coordinate of the head to the start and pop the end one off. Except when you eat and grow in which case you don't delete the last element. Then every tick of the game you update positions, calculate if there's any collisions, change any states and then paint the result.
RajjSinghh@reddit
It sounds like you're overcomplicating it. The snake should probably be an array of every position in the snake. That means moving the snake, checking collisions, or adding to the tail of the snake will just be operations like iterating down the array or adding to the end of it.
You can go and wrap that logic up in a class if it makes it easier to do other things, like drawing to the screen, but that's probably not what you're trying to do.
Miserable_Double2432@reddit
Consider modeling the game board rather than the snake. Snake was written in assembly language, so the grid would have been easier for the developers to reason about
kneeonball@reddit
My suggestion, don’t worry about OOP. Just make it work any way you can first. Then refine and change it.
Any programming paradigm that you “should” do is overrated.
Delivering working software is still priority number 1. Many successful software projects actually have really bad code in terms of maintainability and using the “correct” patterns and practices.
You’re in the stage where making things work is more valuable than trying to make things work with the things like OOP, design patterns, etc.
YetMoreSpaceDust@reddit
Try to just "brute force" it for now - don't worry about trying to write clean code with proper OO, just try to get it working however you can.
AlSweigart@reddit
I always said Tetris was fascinating because it's such a hit game but any software developer could program it in an afternoon.
I could make it in an hour now. It actually took me about four or five afternoons the first time I made it.
p1-o2@reddit
A beginner can only make snake if everything is handled for them. Beginner programmers are given languages where all the work is done for you.
Try making Snake in a game engine at least.
Making a basic Snake in Unity is an afternoon project.
Making Snake from scratch is not an afternoon project unless you've built many games already.
InVultusSolis@reddit
I think more important than knowing everything about OOP is understanding how to picture your game's logic and code accordingly.
First off, it's using the console as a display, correct? Surprisingly, to me that sounds more difficult than using a rendering/windowing library like SDL. There are some libraries like curses/ncurses that make this a bit easier, but there are so many different variables when trying to program something in a console beyond standard
printf
stuff that it's not the most beginner-friendly thing to work with.Also, what are you having a tough time with?
Then-Candle8036@reddit
Its not impostor syndrome if you actually dont know what youre doing lmao
lurgi@reddit
It's a simple project, but not easy. It's broad, but not deep. There are lots of little things that you need to learn (how to draw at a position on the screen), but the individual things are simple, atomic things that you just learn and then apply. There aren't complicated depths that you need to research before you can make it happen and there aren't subtle interactions that you need to worry about.
There is one subtle thing which is how to represent the snake which might not be obvious to a beginning. Fortunately, you can do it the dumb way and it won't matter too much.
teddyone@reddit
making games is very hard and a lot of work. Can be a great way to learn but don't give yourself a hard time, it is NOT easy.
grepTheForest@reddit
Snake game is basically drawing an array to the alternate buffer, read non-blocking input, switch for direction, N ms sleep. On head_end == fruit, --N, make new fruit in random location.
What are you struggling with?
DiligentBathroom9282@reddit (OP)
For now I am struggling with the tail logic. I have a class for Player (head) with controls. And it has a list of segments as a field. Actually I have issues with my constructors' logic. They get their default coordinates from their "previous" segment. Long story short I am lost in the combo of logic and OOP structure
Bomaruto@reddit
Another way of solving it is to represent the game board as a grid.
When you move off a tile, add an tail object with lifetime equal to the size of tail.
For each move, reduce the life of each tail piece by one and remove it when it reaches 0.
Then all you're really concerned about is moving around the head, create tails on space you left and check collision with tail, food or wall.
Not saying this is the best way, but I'm urging you to think differently in how you represent data. Because managing a snake is much harder than managing a board and 4 elements, head, tail, food, wall.
grepTheForest@reddit
Don't need oop for this.
You have a linked list. Each game loop, you remove the last element from the list, and add a new one to the front that has the coordinates of the first element plus/minus 1 in whichever direction of travel. If coordinates of new segment equal the coordinates of any other segments, game over.
DishwashingUnit@reddit
That's not simple. That sounds pretty challenging.
DiligentBathroom9282@reddit (OP)
Yeah. In theory it is like "a simple project every school kid must program at their first time"
TheRealKidkudi@reddit
Here’s a video you might benefit from: What was Coding like 40 years ago?
It’s an interesting video on its own for a good look at what coding in BASIC was like in the 80’s and done using a restored Apple II+. But most relevant to you, he builds a snake game!
It would be helpful to you because he’s certainly building it in a completely different language than you are, so it’s not a straight up tutorial, but it does give you an example of how you might break the problem down into pieces that you can figure out.
DishwashingUnit@reddit
As a game it's simple. As a solo programming project not so much. Doable? Yes, but it would definitely be super challenging for a beginner and is not reason to give up on the craft.
iMac_Hunt@reddit
Yeah I’ve got limited game experience but a fair few years professional software experience. While I’m sure I would get there, it would definitely be a challenge to build a good working version of snake
Bomaruto@reddit
As a full time programmer I don't deal with those of problems. I mostly route data and make sure you've got the permissions to do what you're trying to do.
The skillset I need at work is different from those of a snake game.
Being able to write well structured code is much more important than to solve problems others have solved before you.
If you've not encountered the patterns you need to do something then it will be hard the first time.
So spend more time filling in the gaps in your knowledge and less time worried you don't know what you feel you ought to knowm
HashDefTrueFalse@reddit
You're struggling with a novel problem? Shocking :D
My suggestion is to just write out the rules of snake in plain language. Then try to turn that into very verbose code. Don't jump straight to overcomplicating it with any of the stuff you mentioned in parentheses. Snake can be less than 30 lines of code expressed verbosely (depending on programming language), and even less if you want to get clever, and more if you want to do some OOP.
DiligentBathroom9282@reddit (OP)
Thanks for sharing. rock paper scissors huh? Your f12+paste way doesn't work in Brave tho. Checked it in custom html file :)
HashDefTrueFalse@reddit
Shit :D
I did a few hours work between posting the first paragraph and adding the code. I have just now realised that I forgot we were talking about snake here, not rock/paper/scissors. I answered a question on RPS recently. I'll leave the brainfart up because why not...
I might add a Node.js snake later!
Spec-Chum@reddit
My dude, I've been coding since the 1980s and I still Google the most basic stuff daily lol
I've been using c# since 2017 and I had to Google the syntax of a switch statement last week lol
Honestly, don't sweat it.
As others have said, you're learning so, as I like to say, "if you're not getting stuck, you're doing it wrong"
Jim-Jones@reddit
Games are hard to code.
PaymentTurbulent193@reddit
I'm making a simple game for the first time myself, with a team, and I'm struggling like crazy to do basic shit that I thought would be mostly easy. So I feel you, OP.
DiligentBathroom9282@reddit (OP)
Thanks. It is what I wanted to read!
PaymentTurbulent193@reddit
I have also been learning programming for about a decade now (a little bit less, more like 7-8 years). And a lot of it is forgetting how some OOP stuff works but also how Unity works. Sometimes I get the basic logic of how something should be working and then struggle with actually implementing it even though it turns out I was more or less right in the first place.
Coding is definitely hard and does not come intuitively to me.
recontitter@reddit
I write simple helper scripts at my work in JavaScript. I tried to do a snake have several times and never succeeded. It’s not about programming skills, it’s more about understanding game design logic in my opinion. And it’s not trivial, even for relatively simple games like snake. So, just keep trying.
snarleyWhisper@reddit
You are going from theory to practices, now the real learning begins !
cheezballs@reddit
Woah. A decade? And you're struggling to implement a text based snake game?
djmagicio@reddit
As other said, not imposter syndrome. Building a game (even snake) requires knowledge in multiple domains, not just knowing the syntax of a language and the basics of programming.
This is an applied programming. What’s a game loop? Why do you need one? How/when to accept user input? How do you apply that input? Where does the state live? How do you “show” the user the game in a performant way?
aanzeijar@reddit
Those aren't difficult, and you likely haven't mastered anything, you just know how to use them.
The issue is that most of the stuff that gets taught with OOP nowadays is webshit - api request comes in, you do some data transformation and send response back. Games need a few things you likely never practiced such as data visualisation (even if it's just a snake in ascii art), time dependency (and no,
sleep()
is not the correct way), multithreading (so that input and rendering can happen independently) and sound if you want the full package.Back when we learned, one of the teachers said that if you can implement a Tetris you have seen most of what computing is about. This is your Tetris.
Immediate_Form7831@reddit
I suffer from meta-imposter syndrome: every one who suffers from imposter syndrome is actually not an imposter, except me.
binarycow@reddit
You say you've been programming for a decade. Was any of that time working on "snake" games? Or even games at all?
Software development is a very large field. It has many sub-specialties.
You're just new to this sub-specialty. Writing games requires different techniques than writing a CRUD web app.
PM me if you need to bounce ideas off of someone.
DiligentBathroom9282@reddit (OP)
Thanks! I know I can do it. I just didn't expect it would be such a troublesome experience. It's like there's a whisper in my head saying "ahaha noob, you can't even code a simple console Snake. Every school kid can do it." So it's more about reassurance and support looking post
binarycow@reddit
Eh, no, not really.
At best, every school kid could make something that resembles Snake. They throw some stuff together, it meets the bare minimum requirements, then they're done and move on.
With more experience, you're likely coming at it from a different perspective. You're likely trying to do it right, the first time.
That extra experience may even be a downside for you. You may be trying to over-engineer the game, using patterns/techniques you've picked up over the years.
aqua_regis@reddit
You are far from suffering from "Impostor Syndrome". You are suffering standard beginner struggle, nothing more.
As a beginner you cannot have "Impostor Syndrome" as you don't have external proof of competence - look the definition up in Wikipedia.
Everybody struggles when they face a new problem.
two_three_five_eigth@reddit
And games are some of the hardest programs to make. Keep at it.
anto2554@reddit
What do you mean you've been learning about programming as a hobby for a decade? Have you at all been practicing it?
DiligentBathroom9282@reddit (OP)
It's like a background activity. I read about it, I think about it. Sometime I develop some easy simple utilities for work (usually py). No complex projects so far