@TheProgrammer3 That is a year old comment, jeez!
basically you port it by typing in the bash commands one would use to install and run the program you're porting in an Ubuntu terminal.
It's like reddit but less toxic and cringe, and more intelligent and programming
Fellas, fellas. Real talk. Let us start a pay-it-forward type thing by commenting ideas for an AI to help each other out. I'll go first :)
-Maze navigation (like a lab rat sort of thing) (this is probably what I'll aim for)
-some sort of AI-based opponent for a game (i.e. pong) that learns from a particular player's playstyle
I hope at least one of these helps someone. Now, all we need is an AI that comes up with ideas for AI concepts (hey, that's not such a bad idea...)
10 ways to lose and 1 way to win, and winning is just not losing for 50 days. I love it!
i think that
replees are all good options. However my personal favorite is
Perhaps the ability to bind your own shortcuts? For example, say I wanted to easily switch between a couple files in my project, it would be nice if I could bind keyboard shortcuts to said files (say, alt+1 for the first file, alt+2 for the second, etc.)
Do you think you could add "include programming language in title" or something of that nature? It'd make it a lot easier for one to tell if one can help or not. :)
We can come up with an idea and concepts and such before the challenge starts, right? Or does EVERYTHING have to be done within one month, not just the code itself?
Outputting certain codes to some terminals (including the one repl.it uses) can do specific things to the terminal depending on the code.
\033[2J clears the screen and resets the cursor and the
\033[0;0H moves the cursor to 0,0 (again)
You can change the
Y;X to move the cursor to line
Y and column
X thus allowing you to overwrite only certain portions of your screen. Handy for games and such.
.replit file runs a bash command, like Codemonkey51 said. It's effectively a command for a Linux terminal (in this case, Ubuntu.)
If you want to run multiple commands at once, make a
.bash file and set the command in the
.replit file to run the file (i.e.
A very basic example of what to write in the bash file could be this:
clang++ -std=c++2a *.cpp -o main chmod 744 main ./main
Line 1 compiles all the .cpp files in your base directory (if you want to include all files 1 folder deep, try replacing
*.cpp */*.cpp, might be a better way of accomplishing this but I'm not sure) using the c++2a standard (which is the newest version of C++, you could use c++17 or c++14 etc instead)
Line 2 makes the
main compiled program accessible
Line 3 executes the compiled program
I would honestly suggest excluding the
.replit file altogether unless absolutely necessary until you understand bash at least a little bit. It's not super complex, though, and overall I think it's worth it to learn, especially if you plan on using replit a lot.
When writing your
main function (or any function for that matter) you have to initialize it as a type (i.e.
main I think it has to be an
int. What's happening here is, your compiler is interpreting
main as a function of type
emp, because without a type declaration before
main it assumes the
type directly precedes it, which in this case is
Essentially what you have is
struct emp main which is simultaneously creating an
emp struct and creating the
main function which returns an object of type
emp (which for any other function would be entirely valid BUT
main has to be an
Least favorite things:
I was thinking today that it would be nice if there was like a quick access for files (like where it says the filename at the top of the editor in the IDE there could be a couple tabs with different files you're currently working on, would be nice when working on large and/or complex projects), or even viewing more than one file at once, like side by side or something
I guess that could be dumbed down to more maneuverability with the editor window but you get the idea (i hope)
@Zavexeon I looked into it a bit and it seems that the terminal can sometimes detect mouse clicks but it doesn't seem to be able to get the mouse position on Linux, which is what repl.it runs on. So, clickable buttons on the terminal aren't really an option. @ash15khng If you really want buttons, though, you can have buttons which can be selected using the keyboard, like with arrow keys (don't use the arrow keys) or something of that nature.
please mark this response as the answer if I answered your question :)
I wish my school's computer science class taught C++, it teaches Java which is OK but I am a die hard C++ fan so i never really got into it
Could you link the repl? That way we'll be able to see exactly what's wrong :)
We have rules, now all we need is a ruler....
Polygott, to my understanding, is essentially a way of making makefiles and such on repl.it and to have multiple different languages running in conjunction. I'm sure there's more to it than that, though.
@Mosrod If you don't mind adding that, I think that would be helpful. I'd imagine it'd make things come up more frequently in the search results at least. I've been planning on joining the Discord as soon as I'm able, but right now I'm on a Chromebook from my school, and Discord's blocked. Thanks, though.
Polygott, to the extent of my knowledge, is an experimental repl.it language which allows languages to use binaries from other languages thus allowing for interaction between scripts from multiple languages. It uses Makefile syntax (basically modified Bash) and can do all sorts of useful things like compile external libraries from source, add additional compilation options, etc. Its most useful (imo) feature is that it can install ubuntu packages using
install-pkg PACKAGENAME which opens up a ton of possibilities for porting things and such, or for utilizing libraries not available in native repl.it
Some example programs utilizing Polygott for various purposes:
If you have any more questions @ me :)
Yeahhhh code readability isn't exactly my strong suit :P
side note: this isn't non-blocking (i know you never claimed it was but still)
Anyways good job, it's cool to see people make improvements on things i've made :)
I haven't yet had the problem of NEEDING to stay focused, if I'm programming something i'm interested in, I'll just do it and enjoy it, and if i'm coding something that's just ok, I'll work on it when I'm in the mood. However, I sometimes listen to soundtracks or songs on repeat, repetition in the background i think helps keep me focused.
You can print "\033[0;0H\033[2J" to the console to clear it. This is an ANSI escape code. The
\033[ tells the console that an escape sequence comes next.
0;0H resets the cursor position and
2J actually clears the screen.
Please mark this as the answer if I solved your problem :)
What advice would you give to a newbie?
I'd say not to stress too much about choosing a first language. The skill set required to do coding is pretty easily transferable between modern languages. It's really just best to find a teaching resource that works for you and roll with it :)
And what advice do you wish someone had given you?
I really wish that someone had told me what @eankeen just told you -- Not to be afraid of trying new things. A few months ago I was really avoiding using the
<vector> library (C++) after finding the documentation on it quite confusing at first glance. I was hell-bent on using plain arrays until i finally realized that if I wanted a dynamic array I needed a
vector. Upon actually really using
vectors, I discovered that it's a lot simpler once you get into it, as most coding-related things tend to be.
What advice would you give me, personally?
I don't know that I have advice for you specifically. I do, however, wish you the best of luck in your endeavors as the repl.it community person and as a programmer in general. :)
You can run pretty much anything that runs on Ubuntu using the makefile. Just use
install-pkg instead of
sudo apt-get install. It uses Bash syntax btw.
Try using the shell as @a5rocks said. To save yourself the trouble of typing the whole command the whole time, make a blank file called
main and fill the file with
g++ -std=c++17 *.cpp -o run.o chmod 744 /home/runner/run.o /home/runner/run.o
-std=c++17 sets the language standard to C++17, you can change it to
-std=c++14 etc to use C++14 or whatever else)
to run, open the shell and type