|
|
- #include <LiquidCrystal.h>
-
- int D = 0; // Pointer Divinità in array
- int I = 0; // Pointer Insulto in array
- int agender = 0; // Variable to select non-gendered insults
- int Gender = 1; // Variable to store gender
- int ratio = 1; // Ratio between gendered/non-gendered insults
- unsigned int strlength = 1; // Variable to store Length of individual insult
- String Riga1 = "A"; // String to print for Divinità
- String Riga2 = "B"; // String to print for insult
- char *DivinitaF[] = { "Madonna", "Eva", "Maria",
- "Maria Benedetta", "MadonnaImpestata", "Madre Teresa",
- "Porcamadonna", "Maria Maledetta",
- };
- char *DivinitaM[] = { "Dio", "Giuseppe", "San Giuseppe",
- "Gesu'", "Cristo", "Papa Francesco",
- "Papa Nazingher", "Gesu' Cristo", "DioBestia",
- "Iddio", "Padre Eterno", "Porcoddio",
- "Dio Serpente", "Giuda", "Porco il Clero",
- "Adamo",
- };
- char *InsultiFM[] = {"Sparata", "Arrestata", "Smerdata",
- "Porca", "Stronza", "Galeotta",
- "Merdosa", "Lurida", "Mafiosa",
- "Ladra", "Carbonizzata", "Sciolta",
- "Sudicia", "Assassina", "Sotterrata",
- "Scoppiata", "Ingessata", "Pietrificata",
- "Diavola", "Lupa", "Incazzata",
- "Inviperita", "Marcia", "Infangata"
- "Scatenata", "Piena", "Avvelenata",
- "Sbronza", "Radioattiva", "Pisana",
- "Cogliona", "Velenosa", "Ammazzata",
- "Fascista Appesa", "Lebbrosa", "Drogata",
- "Smutandata", "Catafratta", "Pisana",
- "Infangata", "Asfaltata", "Scivolata",
- "Inchiodata", "Decaffeinata", "Slurdata",
- "Viscida", "Gonfia", "Nana",
- };
- char *InsultiA[] = { "Cane", "A Pedali", "C'ho Fame!",
- "Chepppalle!", "In croce", "con la diarrea",
- "Terrorista", "Camorrista", "Infame",
- "In fiamme", "Fascista", "Boia",
- "Frittata", "Biscia", "in Carriola",
- "Missile", "Serpente", "Maiale",
- "Autostoppista", "Lontra", "Merda",
- "Verme", "Infame", "Agghiacciante",
- "Cinghiale", "Camorrista", "Atomo",
- "Bengala",
- };
-
- int DFSize = sizeof(DivinitaF) / sizeof(DivinitaF[0]); // Automatically calculate size of arrays based on string lenght
- int DMSize = sizeof(DivinitaM) / sizeof(DivinitaM[0]);
- int IFMSize = sizeof(InsultiFM) / sizeof(InsultiFM[0]);
- int IASize = sizeof(InsultiA) / sizeof(InsultiA[0]);
-
- // LCD pins <--> Arduino pins
- const int RS = 11, EN = 12, D4 = 2, D5 = 3, D6 = 4, D7 = 5;
- LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);
-
- void setup()
- {
- ratio = 100*IFMSize/(IFMSize + IASize); //(The smallest IASize, the slimmenst the chance to pick from corresponding array)
- // Setup LCD and print boot messages once
- lcd.begin(16, 2); // set up number of columns and rows
- lcd.setCursor(0, 0); // move cursor to (0, 0)
- lcd.print("GeneratoreRandom");
- lcd.setCursor(0, 1); // move cursor to (0, 1)
- lcd.print("Di Bestemmie 1.1");
- delay(5000);
- lcd.clear(); // Clear LCD before re-draw
- lcd.setCursor(0, 0); // move cursor to (0, 0)
- lcd.print("by AulaStud");
- lcd.setCursor(0, 1); // move cursor to (0, 1)
- lcd.print("2022");
- delay(2000);
-
- }
-
- void loop()
- {
- lcd.clear(); // Clear LCD at every cycle
- Gender = random(1, 3); // Randomly pick F/M as 1 or 2. generate from 1 to n+1 where n is the desired maximum
- if (Gender == 1) { // Check what group has been picked (F/M)
- D = random(1, DFSize); // Randomply pick string in array; from 1 to n+1 where n is the desired maximum
- Riga1 = DivinitaF[D]; // Fill lines that will be printed to LCD
- }
- else if (Gender == 2) { // Check what group has been picked (F/M)
- D = random(1, DMSize);
- Riga1 = DivinitaM[D]; // Fill lines that will be printed to LCD
- }
- agender = random(1, 101);
- if (agender < ratio) { // Extra option to pick Non-gendered insults
- I = random(1, IASize);
- Riga2 = InsultiA[I]; // Fill lines that will be printed to LCD
- }
- else { // else pick insult and change gender
- I = random(1, IFMSize);
- Riga2 = InsultiFM[I]; // Fill lines that will be printed to LCD
- }
- lcd.setCursor(0, 0); // move cursor to (0, 0)
- lcd.print(Riga1); // Print Line1
- lcd.setCursor(0, 1); // move cursor to (0, 1)
- lcd.print(Riga2); // Print Line2
- if (Gender == 2 && agender >= ratio) {
- strlength = Riga2.length() - 1; // get length of current insult string
- lcd.setCursor(strlength, 1); // move cursor to end of insult
- lcd.print("o"); // print final letter over end of line2 to change F to M
- }
- delay(5000); // Delay 5s before next cycle
- agender = 3; // Reset variable
- Riga1 = ""; // Clear strings, or characters will overlap sometimes
- Riga2 = "";
- }
|