Rain
I tried this in python once by doing it by hand, but it was WAYY to hard so I just did this instead.
Anyway, here you go, some satisfying rain.
Edit: kinda snow I guess?
YEEE Trending Boys (and girls) (and non binary people)
Nice!
@BaconErie Thank you :)
@matthewproskils can I have the code. When I copy it it says pharse error on line 12. ALWWAYS!!
@BuurmenTennus https://repl.it/@BuurmenTennus/Rain#main.py Um.. create a .replit file and then move
lang="cpp"
run="clang++-7 -lcurses -pthread -std=c++17 -o main main.cpp && ./main"
there
@matthewproskils How do you make a file?
@BuurmenTennus Actually, make a new repl with the language of c++
@matthewproskils Then paste
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <curses.h>
int main() {
std::vector<std::pair<int, int>> drops = {}; // x, y;
while(true){
std::vector<std::string> map = {};
for(int i=0; i<30;i++){
map.push_back(" ");
}
drops.push_back(std::make_pair(rand() % (map[0].length()-1), 0));
for(size_t i = 0; i < drops.size(); i++){
map[drops[i].second][drops[i].first] = '|';
drops[i].second++;
if(drops[i].second == map.size()){
drops.erase(drops.begin() + i);
i--;
}
}
std::string str = "";
for(size_t j= 0; j < map.size(); j++){
str = str + map[j] + "\n";
}
std::cout << str.c_str();
usleep(50000);
continue;
}
}
into main.cpp
@matthewproskils then I take the lang="cpp"
run="clang++-7 -lcurses -pthread -std=c++17 -o main main.cpp && ./main" and put it there. And just this code
@BuurmenTennus No. You can just press the 'run' button. It'll work then
@matthewproskils So Relaxefulllllllll
@BaconErie Whats ur Roblox Name? Im NotDudeactual2121
@RyanGardiner1 Sorry, I don't play roblox :(
@BuurmenTennus Or you can hit the fork button.
@RyanGardiner1 what? You shouldn't be sharing private information
tbh it looks more like snow but i still liek it
yeah... same @RhinoRunner
Me: I feel like going outside today
Rain: Allow us to introduce ourselves
@much0hackerBOI then bring an umbrella :)
lol. i find that funny @much0hackerBOI
cool! you could always try ❆
S A T I S F Y I N G
ayyy trending! Saw this on my homepage :)
good work :3
@KobeFF Thank you :)
wonderful
good
nice
Very nice, @matthewproskils!
@Gr8est Thank you :)
Wow, cool!
cool
satisfying, very well calculated.
@FlaminHotValdez Thank you :)
Can you add options for snow, hail, and regular rain?
At least you made the "|"'s blue.
so cool!
:o
nice work
ARE YOU CHALLENGING ME?
my option is 6, please help me solve it, forgive me for being in Russian, write me an answer here Yudjil#8570 it's my discord
awesome
im so happy to finally find a c++ project on the trending page
It looks even better now! Congrats on the "animation" (Cant say it is one, but I cant say its not either!)
This is really cool! 🌧☔💦💧
this rain is really satisfyng. I wish whenever it rained it always looks this good
I never realized there was a ".replit" file. Now I know that I don't have to type "gcc -lncurses" in the shell all the time. Thank you!
If you want it to be more accurate you could add "std::cout << "\033[34m";"
such that the code becomes
#include <vector>
#include <map>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <curses.h>
int main() {
std::cout << "\033[34m"; //Right Here!
std::vector<std::pair<int, int>> drops = {}; // x, y;
while(true){
std::vector<std::string> map = {};
for(int i=0; i<30;i++){
map.push_back(" ");
}
drops.push_back(std::make_pair(rand() % (map[0].length()-1), 0));
for(size_t i = 0; i < drops.size(); i++){
map[drops[i].second][drops[i].first] = '|';
drops[i].second++;
if(drops[i].second == map.size()){
drops.erase(drops.begin() + i);
i--;
}
}
std::string str = "";
for(size_t j= 0; j < map.size(); j++){
str = str + map[j] + "\n";
}
std::cout << str.c_str();
usleep(50000);
continue;
}
}
This would just make the rain blue.
Also if you want snowflakes (Probably a better way to do it than this but here you go):
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <curses.h>
int main() {
std::cout << "\033[34m";
std::vector<std::pair<int, int>> drops = {}; // x, y;
while(true){
std::vector<std::string> map = {};
for(int i=0; i<30;i++){
map.push_back(" ");
}
drops.push_back(std::make_pair(rand() % (map[0].length()-1), 0));
for(size_t i = 0; i < drops.size(); i++){
map[drops[i].second][drops[i].first] = '|';
drops[i].second++;
if(drops[i].second == map.size()){
drops.erase(drops.begin() + i);
i--;
}
}
std::string str = "";
for(size_t j= 0; j < map.size(); j++){
str = str + map[j] + "\n";
}
for(int a = 0;a < str.length();a++){
if(str[a] == '|'){
std::cout << "❄";
}else{
std::cout << str[a];
}
}
usleep(50000);
continue;
}
}
@Kingoftheof1 🤔 Unicode escape characters... Good idea! Thank you :)
a bunch of the letter I... lol cute :)
In the Northern Hemisphere, it is so cold that the rain you made became snow. My backyard is now Mt. Everest. Love the work!
@RoyalCoder1234 Hahaha 🤣
lol @RoyalCoder1234
@RoyalCoder1234 I dont know how do u manage to live at the pole ...
I live in India which is somewhat near the equator and still during this season we are like we dont wanna get out of the bed
@HimanshuShekha4 no, The poles are at 90 degrees latitude either way.
The furthest north livable terrain is at 78 degrees north, at Svalbard, just north of norway. And they don't have internet there.
@firefish Thx for the info. I guess my joke wasn't scientifically correct.
@RoyalCoder1234
it was a joke? oh no@firefish You kidding me ? 😅😅
@HimanshuShekha4 i didn't realise :/
@RoyalCoder1234 that is the best joke I have heard from the time I came in to repl.it🤣🤣😂
@gwynethwingell then you havent been on replit. lol
@RoyalCoder1234 Are you sure it isn't one of those video call backgrounds? XD