Added the Game Loop
This commit is contained in:
parent
28126de50c
commit
0f7d9022c4
2 changed files with 27 additions and 3 deletions
24
Lingo/GameLoop.cs
Normal file
24
Lingo/GameLoop.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
namespace Lingo;
|
||||||
|
|
||||||
|
public class GameLoop
|
||||||
|
{
|
||||||
|
public string SelectedWord {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Setup.wordSelector();
|
||||||
|
}
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
public string InputWord {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Setup.inputWord();
|
||||||
|
}
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameLoop()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,15 +4,15 @@ public static class Setup
|
||||||
{
|
{
|
||||||
static Random rnd = new Random();
|
static Random rnd = new Random();
|
||||||
static string[] words = File.ReadAllLines("words.txt");
|
static string[] words = File.ReadAllLines("words.txt");
|
||||||
|
|
||||||
static string wordSelector()
|
public static string wordSelector()
|
||||||
{
|
{
|
||||||
int rand = rnd.Next(0, words.Length);
|
int rand = rnd.Next(0, words.Length);
|
||||||
string selectedWord = words[rand];
|
string selectedWord = words[rand];
|
||||||
return selectedWord;
|
return selectedWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string inputWord()
|
public static string inputWord()
|
||||||
{
|
{
|
||||||
string inputWord = Console.ReadLine();
|
string inputWord = Console.ReadLine();
|
||||||
return inputWord;
|
return inputWord;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue