hacker

Will Carey

@SPQR (524) • George Mason University
Hi, I like code, ESPECIALLY C++. . I know Polygott, and I use it to port things. Currently pursuing a degree in Computer Science.
Polygott
posted to Ask by Masy

@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.

so this is basically reddit...
posted to Ask by SansUnd3rtale

It's like reddit but less toxic and cringe, and more intelligent and programming

Artificial Intelligence Competition
posted to Share by lydiahallie

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 :)
-Text prediction
-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...)

1300's Peasant Simulator
posted to Share by RomeroSchwarz

10 ways to lose and 1 way to win, and winning is just not losing for 50 days. I love it!

What do you call people who use Repl.it?
posted to Ask by Four_Of_Clubs

i think that replers or replists or replators or replologists or reploids or replees are all good options. However my personal favorite is

CHILDREN OF THE REPL

What kinds of keyboard shortcuts would you use on Repl.it?

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.)

Guide to Asking Coding Questions
posted to Ask by Mosrod

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. :)

Game Jam FAQ
posted to Share by katyadee

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?

I want to use clear screen function in my c++ code on repl
posted to Ask by RishuMishra

@RishuMishra https://en.wikipedia.org/wiki/ANSI_escape_code
Outputting certain codes to some terminals (including the one repl.it uses) can do specific things to the terminal depending on the code.
The \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 0;0 to 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.

How do I run a file using .replit
posted to Ask by DynamicSquid

the .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. bash main.bash)

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 with *.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.

I have complied the following script & I am unable 2 understand the error to resolve it
posted to Ask by Aravind

When writing your main function (or any function for that matter) you have to initialize it as a type (i.e. int, char, bool). For 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 struct emp.

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 int.)

What is the language you recommend the most? Why do you recommend it??
posted to Ask by qualladoom

Depends on what you want to do with it. If you're looking for anything web related, I'd recommend JavaScript (and perhaps HTML and CSS), because it's by far the most common and useful language for that purpose. If you're looking to make anything desktop-based, I'd recommend C++, especially if you want to run it on your Raspberry Pi, because C++ is extremely optimized for performance and has a lot of low-level hardware access. However I won't lie to you, C++ is a bit tricky to learn, and a significant step up from python, so only get into that if you think you're up for it. To be fair, though, C++ is the only language I'm currently familiar with, so I'm a bit biased.

What's your favorite thing about Repl.it? What about your least favorite?
posted to Ask by katyadee

Favorite thing(s):

  • Portability (the fact that i can access it from anywhere, even my chromebook)
  • ease of collaboration (multiplayer) and sharing
  • The community :) (just wanna mention that i'm under "more top contributors" in all time, past 7 days, and past 30 days, and i'm pretty darn proud of that)

Least favorite things:

  • Lack of configurability (you have to use polygott to do anything advanced)

SLASH

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)

Clickable terminal
posted to Ask by ash15khng

@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 :)

The Best Way To Code (Joke)
posted to Share by Edgod
this.willToLive = ~WillToLive()
Game made for a class: D-2200
posted to Share by Corwin_Strahan

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

Creating header files for a C++ class
posted to Ask by kmcrae

Could you link the repl? That way we'll be able to see exactly what's wrong :)

Repl Talk Rules and Guidelines [README]
posted to Announcements by mat1

We have rules, now all we need is a ruler....

What is polygott?
posted to Ask by Vandesm14

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.

Guide to Asking Coding Questions
posted to Ask by Mosrod

@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
posted to Ask by Masy

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:

This port of Doom 1
This SDL program (SDL is normally not usable on repl.it)

If you have any more questions @ me :)

C++ Keyboard InputManager v1.0.0
posted to Share by CowNationz

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 :)

What do you do for keeping your concentration while coding?
posted to Ask by qualladoom

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.

Clearing a screen in repl.it for the C language
posted to Ask by Yuvikiit

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 should we code?
posted to Ask by katyadee

@Wetyuip I've got a project going in C++ and SFML that i think shows a bit of promise, want to take a look at it?

What advice would you give to someone new to coding?
posted to Ask by katyadee

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. :)

Phony and Makefile.
posted to Ask by IzanLarumbe

@a5rocks @IzanLarumbe yep. You've installed firefox but you have to run it to see any output. You can just add the firefox on the line below and you should be set.

Phony and Makefile.
posted to Ask by IzanLarumbe

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.

How do I enable C++14, C++17, C++2a and switch compilers
posted to Ask by hooddanielc

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

(g++ or gcc)
(-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 bash main.