Share your repls and programming experiences

← Back to all posts
[ GAME ] Press Enter To Win!
h
Coder100 (18099)

Press Enter To Win

Do you want a completely TERMINAL-BASED game made in C++ where all you do is press enter?

Yeah me too so that's why I made this.

About

I wanted to try my hand at some more C++ again, and never again will I do that again too unsafe back to rust.

How To Play

Press Enter, or not.

Screenshots

lol

Closing

Hope you enjoyed the game! Don't forget to fork, comment, and react!
https://replit.com/@Coder100/press-enter-to-win-the-game-game-c-yay?v=1

Comments
hotnewtop
fuzzyastrocat (1864)

too unsafe

pfft, a language is only as unsafe as the programmer is careless :)

But I have to agree that C++ is horrible... though not for the same reason

Whippingdot (652)

If you hate C++, DON'T SAY IT OUT LOUD AAAAAAAAAAAAAAAAAAA WE ALREADY HAD A BIG THREAD ON THIS FIGHT SO STOP SAYING THAT AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @fuzzyastrocat

Coder100 (18099)

yeah
idk
i don't like how there is no built in thread safety

oh great rust programmer teach us the ways of thread safety @fuzzyastrocat

fuzzyastrocat (1864)

@Whippingdot Wait, why is it wrong for me to say that I don't like C++? I'm honestly very confused... all I'm saying is that it's my opinion I don't like C++, in agreement with Coder100 (to make a joke). Is there something wrong with that?

Would you take offense if I say "I hate BASIC"?

fuzzyastrocat (1864)

@Coder100 Hehe yes, I'm kinda on the fence about Rust though because I find it really restricting due to its "safety guards". Like, sometimes I know a way to more efficiently implement something in memory, but because it's technically not 100% safe (if I don't use it properly elsewhere) I can't use it in Rust because Rust won't allow me to implement anything that even has the potential to be unsafe.

SHADOWSWALKING (1)

@Coder100 C++ is the only language that trusts its user not to be an idiot, therefore increasing the speed at which the language runs.

fuzzyastrocat (1864)

@Coder100 Ah yes, but then I'm not being a happy rustacean and I don't get any of the benefits of rust anymore! I might as well be using C at that point, since all code that contains other unsafe code must become unsafe.

fuzzyastrocat (1864)

@SHADOWSWALKING Well, C++ isn't the only language that trusts the user isn't an idiot...

And also, I wouldn't say that that increases the speed of the language. If you write a program with the naivest implementation in C++, it'll still be slow-as-dirt. But the power of a language like C++ is that there's nothing getting in the way between you and the machine, so if you write a fast implementation it will be executed faithfully (and thus quickly).

SHADOWSWALKING (1)

@fuzzyastrocat It was a joke really but I think it takes away unnecessary runtime checks which makes it run a little faster. Basically C++ is fine if you are not a moron.

Coder100 (18099)

Idk c++ is fine but it's literally just std::c
And that makes me unhappy @fuzzyastrocat

fuzzyastrocat (1864)

@SHADOWSWALKING It's more like it doesn't need the runtime checks because everything is verifiable at compile-time, but yes.

fuzzyastrocat (1864)

@Coder100 I don't like C++ because it's just too bloated. They tried to add huge numbers of features to a system (C) which doesn't work well with having huge numbers of features since it isn't built that way, and they ended up with a mess.

xxpertHacker (930)

@Whippingdot But... they're not wrong ¯_(ツ)_/¯
And stop spamming.

Whippingdot (652)

Bruh wut do you mean they are not wrong... @xxpertHacker

@fuzzyastrocat I know, you always say that, I just don't understand what that means. Isn't lots of features good?

Coder100 (18099)

Not when it's equally hard to do everything @Whippingdot

xxpertHacker (930)

@Whippingdot C++ is bloated.

Also, you seem to not genuinely grasp the complexity that is ISO C++?

Regardless, here's a C++ Repl to make your day that much better: https://replit.com/@xxpertHacker/dont-try-this-at-home.
Enjoy!

Whippingdot (652)

Well i am pretty much a beginner in C++ (thought I have been learning it for a year) so I don't know as much as you probably know. I do not understand why you gave me the link of that repl...

Also I want to game design with C++ in the future, is game designing with it alright or... @xxpertHacker

fuzzyastrocat (1864)

@Whippingdot, I think @Coder100 summed up my idea very well. Sure, having lots of features is great, but it's absolutely useless if they're not managed in a way that allows the user to gracefully include them. And C++ completely failed in that respect since they just followed after C — as I put it earlier, they added their features to

a system (C) which doesn't work well with having huge numbers of features ... and they ended up with a mess

@xxpertHacker linked the repl to illustrate how horribly unreadable and mangled C++ can become.

Here's a good reddit thread on gamedev in C++: https://www.reddit.com/r/learnprogramming/comments/c892va/is_c_better_that_c_for_game_development/

xxpertHacker (930)

@fuzzyastrocat Ha, thanks for actually opening the Repl! Precisely what it was intended for. The language can easily be abused in ways that no other language should be, and becomes highly counter intuitive. That associative_array doesn't remotely look like C++ at all, but is is :) it's merely not idiomatic C++.
@Whippingdot Open it, read the main function.

In order to create that construct that I had, it requires a lot of knowledge about C++'s ins and outs too. Replace a temporary with a variable in the map, and you have a problem...

Coder100 (18099)

ok i'm going back to unity c# <3 @xxpertHacker

xxpertHacker (930)

@Coder100 Na, just write more code like that Repl <3

Whippingdot (652)

You haven't really given your opinion on if I should do game dev in C++ or in C# yet...That post was very useful and so I learned a lot from the second comment, but the thing is, the first and second guy said two things:

  1. The first guy said that you should probably learn C# first because it is easier, but the thing is, I already learned C++...

  2. The second guy said that unreal and unity might be too advanced, and so we should use love2d or gotodo or something, bu the problem with those is that it means I should learn new languages - lua (I am pretty sure love2d runs on that) and that gotod language.

Give me your solution to these problems, if you can! @fuzzyastrocat

Whippingdot (652)

OOO you included that map library and you did stuff with that library which isn't the main parts of C++, and it is like an ad on, meaning it has unnecessary functionality or stuff like that... Also, wait even iostream seems un-natural for C++, that is why I am your to use printf or that other one from now on as it seems more C++ like... @xxpertHacker

Coder100 (18099)
  1. That won't be the only language you learn I hope
  2. No godot has the option to use c#, and again, why not learn a new language?

@Whippingdot

Whippingdot (652)

Bro, I already learned C++, Python, and HTML. I am almost done learning CSS, and I am halfway through JS. Next, I am going to learn Nodejs. Then I should be done learning everything I want. @Coder100

Whippingdot (652)

Also, I am not really done with C++, as the course I was doing got refreshed, and now I have to start from the bottom again...

Do you still think I should learn C# too? @Coder100

fuzzyastrocat (1864)

@Whippingdot First off, you've completely misunderstood my purpose in posting that thread. Read the bits about C++:

Either one is fine. With C#, you can use Unity, and with C++ you can use the Unreal Engine (among others).

from my personal experience learning c++ first is GREAT if you can manage it.

C++ is used in some engines like Unreal Engine or Frostbyt but they are WAY more enterprise level.

the Godot Engine (god bless it), it's a free and open source game engine and it's very very good (also kinda easier than Unity or Unreal Engine) ... and also has C++ bindings

I'm not going to give an opinion since I don't know that much about you or what your goal is. It really depends on what you think is best.

As for the C++ repl, I actually don't think that's the intended point. map and iostream are both very standard libraries, and their use is okay. But look at the actual code that has been written. Like, what the hek does this mean:

list_wrapper operator,(pair_wrapper const&& next) const {
	return list_wrapper(*this), std::move(next);
}

(I ask this rhetorically, obviously — but you can see how unintuitive it is.) So the point of the repl is not the libraries but rather the fact that the code ends up as a mangled mess because it uses many of C++'s features.

Also, I am not really done with C++, as the course I was doing got refreshed, and now I have to start from the bottom again...

In my opinion, courses are absolutely and completely useless once you've programmed before. For me, the best and only way to really learn a new language is to do a project in it. If you're learning C++ for gamedev, then the implication is obvious. (I'm not saying abandon the course if you want to keep following it, this is just a strategy that has worked well for me.)

As far as learning C# goes, try out Unity and see if you like it. If you do, learn C# along the way. If not, no biggie, do something else.

Whippingdot (652)

Man, you are definitely one of the most helpful people in the community @fuzzyastrocat!

First, what does that person mean by saying that the Godot engine has C++ bindings?

Second, it is ok if you don't think you should give an opinion...

Third, I see that now - I don't understand half the code and I thought that was because I wasn't educated enough in C++...

Fourth, I see what you mean. I am creating programs too, but I also feel like I am very un-educated in C++ and so I want to use the courses to see if I can find any new features that more experienced users like you guys use.

Fifth, I do like Unity too. I actually like Unity a little better than Unreal (my personal opinion) for some unknown reason...I will maybe try out Unity and C# in the future before I try Unreal Engine. The main deciding factor would be if Unity is more simple than Unreal. If it is, I would use Unity for game development now (like while I am young), and I would use Unreal Engine to game dev professionally (I still don't know if I am going to do game dev in the future so this doesn't really matter). From what I know, C# and C++ are pretty similar (I don't know that for sure though) and so if like for the first two years I use Unity and C# for game development, I can get used to how Unreal works and maybe how C++ works in game dev too.

fuzzyastrocat (1864)

@Whippingdot Oh thanks!

"Godot has C++ bindings" means (put simply) "You can use C++ with Godot"

One thing about the courses, I actually find that I will completely forget any advanced features if I just read about them in a course. But, if I start a project and run into a brick wall, some stackoverflow-fu will lead me to the advanced feature I need and from then on I'll always remember how to use that feature. It depends on the person though, some people can remember things really well if they read them.

Unity is certainly more simple than Unreal because it uses C#, which is generally more user-friendly than C++. C# and C++ actually have a lot of differences — C++ is basically just "improved C" (improved in quotes since, well, you know my opinion), that is, a very low-level language with a bunch of helper things added. C#, on the other hand, is a much higher-level language; it's sort of like "improved Java".

Whippingdot (652)

Thanks for that explanation lul (laugh ut loud) @fuzzyastrocat

Also, welp do you still think I should learn C# and do that first? Or do you think I should just go with C++ and use Unreal Engine? Sorry for asking you everything, as I know you won't know the answers to everything. If you say it is my opinion, I will think about it and choose later. You don't have to give me an answer!

Thanks for everything you have said already!

P.S. I'll try your method of learning C++ - see if it works

fuzzyastrocat (1864)

@Whippingdot As alluded to in the last paragraph, I would suggest learning C# first to get a feel for how a game engine works. Then, once you've got a good idea of how everything goes, switch to C++ (if you want) and go to Godot/Unreal. (C++ isn't as easy to work with, so if you've never done anything with game engines before it would be a gentler introduction to start with Unity/C# and then later switch to C++. Of course, it's certainly possible to start off either way, but it depends on if you're okay with potentially finding things too difficult at first.)

Bunnytoes (116)

I like it :D but I still need help with my .replit file

Coder100 (18099)

thanks!
what is your question? @Bunnytoes

Bunnytoes (116)

@Coder100 I have the .replit file all ready but it says permission denied

Coder100 (18099)

yeah no that's not how that works

do this:

run = "cd TDFORREPLIT ; npx static-here"

you can't just specify a file, you have to specify the run command
@Bunnytoes

Bunnytoes (116)

@Coder100 it worked! but now it says Unable to parse Build/TDFORREPLIT.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug.

Coder100 (18099)

yeah make sure to disable the zipping and add a fallback @Bunnytoes

Bunnytoes (116)

@Coder100 how?also you have been so helpful thanks

Coder100 (18099)

build settings
so that's in like edit > settings > build settings @Bunnytoes

Bunnytoes (116)

@Coder100 or ctrl shift b I know, but I can't find where I change it

FloCal35 (668)

Hope you enjoyed the game! Don't forget to fork, comment, and react

Don't forget too smash that upvote, comment YOUR feedback, and react in the spotlight page and click the bell so you don't miss a thing

xXToluwaXx (72)

this deserves the what to do when bored award top notch

Kirit0 (34)

Me: reads comments
Also Me: I like python :3
.
.
.
This a great game, but kinda cheap that you can just hold down enter bar :T

Coder100 (18099)

thanks!

Yeah, so that is why you only have a 50% chance of getting more enters @Kirit0

IGamer123 (76)

Holy Crap I dunno What i am doing

oops

FlaminHotValdez (685)

*puts a paperweight on my enter key*