using System; using System.Collections.Generic; namespace OffbrandWordle { class Program { static void Main(string[] args) { List<string> Words = new List<string>(); //Word List Words.Add("adult"); Words.Add("agent"); Words.Add("anger"); Words.Add("apple"); Words.Add("award"); Words.Add("beach"); Words.Add("birth"); Words.Add("block"); Words.Add("board"); Words.Add("brain"); Words.Add("bread"); Words.Add("break"); Words.Add("brown"); Words.Add("brand"); Words.Add("beast"); Words.Add("bench"); Words.Add("cello"); Words.Add("beans"); Words.Add("brave"); Words.Add("brass"); Words.Add("grass"); Words.Add("green"); Words.Add("mouse"); Words.Add("bored"); Words.Add("board"); Words.Add("beard"); Words.Add("phone"); Words.Add("brick"); Words.Add("breed"); Words.Add("plane"); Words.Add("plank"); Words.Add("squat"); Words.Add("camel"); Words.Add("crown"); Words.Add("crate"); Words.Add("creed"); Words.Add("greed"); Words.Add("plead"); Words.Add("speed"); Words.Add("steed"); Words.Add("carry"); Words.Add("curry"); Words.Add("hurry"); Words.Add("cause"); Words.Add("chain"); Words.Add("motto"); Words.Add("count"); Words.Add("glass"); Words.Add("candy"); Words.Add("laugh"); Words.Add("anime"); Words.Add("manga"); Words.Add("demon"); Words.Add("scare"); Words.Add("stole"); Words.Add("stand"); Words.Add("sheet"); Words.Add("music"); Words.Add("staff"); Words.Add("steal"); Words.Add("panda"); Words.Add("print"); Words.Add("perch"); Words.Add("parch"); Words.Add("purse"); Words.Add("craft"); Words.Add("close"); Words.Add("clash"); Words.Add("clock"); Words.Add("cream"); Words.Add("climb"); Words.Add("gongs"); Words.Add("power"); Words.Add("snake"); Words.Add("badge"); Words.Add("paper"); Words.Add("chair"); Words.Add("table"); Words.Add("spoon"); Words.Add("knife"); Words.Add("plate"); Words.Add("pasta"); Words.Add("spill"); Words.Add("spork"); Words.Add("sport"); Words.Add("trash"); Words.Add("model"); Words.Add("chest"); Words.Add("limit"); Words.Add("cloud"); Words.Add("chief"); Words.Add("spine"); Words.Add("boing"); Words.Add("chore"); Words.Add("paint"); Words.Add("white"); Words.Add("black"); Words.Add("child"); Words.Add("coast"); Words.Add("night"); Words.Add("human"); Words.Add("puppy"); Words.Add("zebra"); Words.Add("sound"); Words.Add("chime"); Words.Add("river"); Words.Add("piano"); Words.Add("shirt"); Words.Add("under"); Words.Add("haven"); Words.Add("ghost"); Words.Add("scarf"); Words.Add("grill"); Words.Add("chill"); Words.Add("crack"); Words.Add("sugar"); Words.Add("flour"); Words.Add("melon"); Words.Add("money"); Words.Add("mango"); Words.Add("bring"); Words.Add("broom"); Words.Add("sting"); Words.Add("steam"); Words.Add("smell"); Words.Add("taste"); Words.Add("sight"); Words.Add("touch"); Words.Add("voice"); Words.Add("speak"); Words.Add("after"); Words.Add("while"); Words.Add("stick"); Words.Add("stern"); Words.Add("spank"); Words.Add("spank"); Words.Add("bling"); Words.Add("broke"); Words.Add("brain"); Words.Add("brawl"); Words.Add("misty"); Words.Add("blink"); Words.Add("flame"); Words.Add("ditto"); Words.Add("drink"); Words.Add("koala"); Words.Add("clown"); Words.Add("hover"); Words.Add("cower"); Words.Add("cover"); Words.Add("tower"); Words.Add("glock"); Words.Add("roach"); Words.Add("harsh"); Words.Add("cross"); Words.Add("disco"); Words.Add("cocoa"); Words.Add("slide"); Words.Add("aback"); Words.Add("acorn"); Words.Add("admin"); Words.Add("essay"); Words.Add("fruit"); Words.Add("humor"); Words.Add("chant"); Words.Add("banjo"); Words.Add("cough"); //Random Word Picker Random numberGen = new Random(); int random = 0; //Choices Console.WriteLine("Start the game"); Console.WriteLine("Old or New Layout?"); string answer = Console.ReadLine(); //New if (answer == "New") { Console.WriteLine("Do You Want Asian Mode?"); answer = Console.ReadLine(); //Yes if (answer == "Yes") { for(int i = 0; i < 1; i++) { random = numberGen.Next(0, 163); } string theWord = (Words[random]); Console.WriteLine("Type your first guess (lowercase only)"); //Guessing for(int i = 0; i < 7; i++) { Console.ForegroundColor = ConsoleColor.White; string guess = Convert.ToString(Console.ReadLine()); char a = theWord[0]; char b = theWord[1]; char c = theWord[2]; char d = theWord[3]; char e = theWord[4]; char aa = guess[0]; char bb = guess[1]; char cc = guess[2]; char dd = guess[3]; char ee = guess[4]; //First Letter Guess if(a == aa) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(aa); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(aa); } //Second Letter if(b == bb) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(bb); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(bb); } //Third Letter if(c == cc) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(cc); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(cc); } //Fourth Letter if(d == dd) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(dd); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(dd); } //Fifth Letter if(e == ee) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(ee); Console.WriteLine(""); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ee); Console.WriteLine(""); } //Win if(guess == theWord) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You did it!"); i = 999; } } Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("The Word Was: "+theWord); } //No else if (answer == "No") { for(int i = 0; i < 1; i++) { random = numberGen.Next(0, 163); } string theWord = (Words[random]); Console.WriteLine("Type your first guess (lowercase only)"); //Guessing for(int i = 0; i < 9; i++) { Console.ForegroundColor = ConsoleColor.White; string guess = Convert.ToString(Console.ReadLine()); char a = theWord[0]; char b = theWord[1]; char c = theWord[2]; char d = theWord[3]; char e = theWord[4]; char aa = guess[0]; char bb = guess[1]; char cc = guess[2]; char dd = guess[3]; char ee = guess[4]; //First Letter if(a == aa) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(aa); } else if(b == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(aa); } else if(c == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(aa); } else if(d == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(aa); } else if(e == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(aa); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(aa); } //Second Letter if(b == bb) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(bb); } else if(a == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(bb); } else if(c == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(bb); } else if(d == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(bb); } else if(e == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(bb); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(bb); } //Third Letter if(c == cc) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(cc); } else if(a == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(cc); } else if(b == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(cc); } else if(d == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(cc); } else if(e == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(cc); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(cc); } //Fourth Letter if(d == dd) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(dd); } else if(a == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(dd); } else if(b == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(dd); } else if(c == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(dd); } else if(e == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(dd); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(dd); } //Fifth Letter if(e == ee) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(ee); Console.WriteLine(""); } else if(a == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(ee); Console.WriteLine(""); } else if(b == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(ee); Console.WriteLine(""); } else if(c == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(ee); Console.WriteLine(""); } else if(d == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(ee); Console.WriteLine(""); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ee); Console.WriteLine(""); } //Win if(guess == theWord) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You did it!"); i = 999; } } Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("The Word Was: "+theWord); } //Wait Before Closing Console.ReadKey(); } //Old else if(answer == "Old") { Console.WriteLine("Do You Want Asian Mode?"); answer = Console.ReadLine(); //Yes if (answer == "Yes") { for(int i = 0; i < 1; i++) { random = numberGen.Next(0, 158); } string theWord = (Words[random]); Console.WriteLine("Type your first guess (lowercase only)"); //Guessing for(int i = 0; i < 7; i++) { Console.ForegroundColor = ConsoleColor.White; string guess = Convert.ToString(Console.ReadLine()); char a = theWord[0]; char b = theWord[1]; char c = theWord[2]; char d = theWord[3]; char e = theWord[4]; char aa = guess[0]; char bb = guess[1]; char cc = guess[2]; char dd = guess[3]; char ee = guess[4]; //First Letter Guess if(a == aa) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The First Letter Matches!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The First Letter Does Not Match"); } //Second Letter if(b == bb) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Second Letter Matches!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Second Letter Does Not Match"); } //Third Letter if(c == cc) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Third Letter Matches!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Third Letter Does Not Match"); } //Fourth Letter if(d == dd) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Fourth Letter Matches!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Fourth Letter Does Not Match"); } //Fifth Letter if(e == ee) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Fifth Letter Matches!"); Console.WriteLine(""); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Fifth Letter Does Not Match"); Console.WriteLine(""); } //Win if(guess == theWord) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You did it!"); i = 999; } } Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("The Word Was: "+theWord); } //No else if (answer == "No") { for(int i = 0; i < 1; i++) { random = numberGen.Next(0, 158); } string theWord = (Words[random]); Console.WriteLine("Type your first guess (lowercase only)"); //Guessing for(int i = 0; i < 9; i++) { Console.ForegroundColor = ConsoleColor.White; string guess = Convert.ToString(Console.ReadLine()); char a = theWord[0]; char b = theWord[1]; char c = theWord[2]; char d = theWord[3]; char e = theWord[4]; char aa = guess[0]; char bb = guess[1]; char cc = guess[2]; char dd = guess[3]; char ee = guess[4]; //First Letter if(a == aa) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The First Letter Matches!"); } else if(b == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The First Letter Is In The Wrong Spot!"); } else if(c == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The First Letter Is In The Wrong Spot!"); } else if(d == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The First Letter Is In The Wrong Spot!"); } else if(e == aa) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The First Letter Is In The Wrong Spot!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The First Letter Does Not Match"); } //Second Letter if(b == bb) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Second Letter Matches!"); } else if(a == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Second Letter Is In The Wrong Spot!"); } else if(c == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Second Letter Is In The Wrong Spot!"); } else if(d == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Second Letter Is In The Wrong Spot!"); } else if(e == bb) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Second Letter Is In The Wrong Spot!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Second Letter Does Not Match"); } //Third Letter if(c == cc) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Third Letter Matches!"); } else if(a == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Third Letter Is In The Wrong Spot!"); } else if(b == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Third Letter Is In The Wrong Spot!"); } else if(d == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Third Letter Is In The Wrong Spot!"); } else if(e == cc) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Third Letter Is In The Wrong Spot!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Third Letter Does Not Match"); } //Fourth Letter if(d == dd) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Fourth Letter Matches!"); } else if(a == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fourth Letter Is In The Wrong Spot!"); } else if(b == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fourth Letter Is In The Wrong Spot!"); } else if(c == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fourth Letter Is In The Wrong Spot!"); } else if(e == dd) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fourth Letter Is In The Wrong Spot!"); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Fourth Letter Does Not Match"); } //Fifth Letter if(e == ee) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The Fifth Letter Matches!"); Console.WriteLine(""); } else if(a == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fifth Letter Is In The Wrong Spot!"); Console.WriteLine(""); } else if(b == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fifth Letter Is In The Wrong Spot!"); Console.WriteLine(""); } else if(c == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fifth Letter Is In The Wrong Spot!"); Console.WriteLine(""); } else if(d == ee) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The Fifth Letter Is In The Wrong Spot!"); Console.WriteLine(""); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The Fifth Letter Does Not Match"); Console.WriteLine(""); } //Win if(guess == theWord) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You did it!"); i = 999; } } Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("The Word Was: "+theWord); } //Wait Before Closing Console.ReadKey(); } } } }
Write, Run & Share C# code online using OneCompiler's C# online compiler for free. It's one of the robust, feature-rich online compilers for C# language, running on the latest version 8.0. Getting started with the OneCompiler's C# compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C#
and start coding.
OneCompiler's C# online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
using System;
namespace Sample
{
class Test
{
public static void Main(string[] args)
{
string name;
name = Console.ReadLine();
Console.WriteLine("Hello {0} ", name);
}
}
}
C# is a general purpose object-oriented programming language by Microsoft. Though initially it was developed as part of .net but later it was approved by ECMA and ISO standards.
You can use C# to create variety of applications, like web, windows, mobile, console applications and much more using Visual studio.
Data Type | Description | Range | size |
---|---|---|---|
int | To store integers | -2,147,483,648 to 2,147,483,647 | 4 bytes |
double | to store large floating point numbers with decimals | can store 15 decimal digits | 8 bytes |
float | to store floating point numbers with decimals | can store upto 7 decimal digits | 4 bytes |
char | to store single characters | - | 2 bytes |
string | to stores text | - | 2 bytes per character |
bool | to stores either true or false | - | 1 bit |
datatype variable-name = value;
When ever you want to perform a set of operations based on a condition or set of few conditions IF-ELSE is used.
if(conditional-expression) {
// code
}
else {
// code
}
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
Switch is an alternative to If-Else-If ladder.
switch(conditional-expression) {
case value1:
// code
break; // optional
case value2:
// code
break; // optional
...
default:
// code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement) {
// code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Array is a collection of similar data which is stored in continuous memory addresses. Array values can be fetched using index. Index starts from 0 to size-1.
data-type[] array-name;
Method is a set of statements which gets executed only when they are called. Call the method name in the main function to execute the method.
static void method-name()
{
// code to be executed
}