public void DeleteFileVariable(string n) { FileVariables.Delete(n); }
public void DeleteFileVariableWildcard(string n) { FileVariables.DeleteWildcard(n); }
static void Main(string[] args) { int Xaxis = int.Parse(Line1(args[0], 0)); //sets int Xaxis as the horizontal length from the txt file int Yaxis = int.Parse(Line1(args[0], 1)); //sets int Yaxis as the Vertical length from the txt file string[,] Letterboard = new string[Yaxis, Xaxis]; // 2d array to create the board int NumOfwords = int.Parse(Line1(args[0], 2)); FileVariables[] Word = new FileVariables[NumOfwords]; // Parses the return of Line1 method into int for (int i = 0; i < NumOfwords; i++) //Loop made to cycle through the Words, row, column, and direction from the txt files { Word[i].words = TxtFileData(args, i)[0]; Word[i].row = int.Parse(TxtFileData(args, i)[1]); Word[i].column = int.Parse(TxtFileData(args, i)[2]); Word[i].direction = TxtFileData(args, i)[3]; } Random rng = new Random(); Console.Write(" "); for (int y = 0; y < Yaxis; y++) // Vertical length { Console.ForegroundColor = ConsoleColor.Yellow; //changes Yaxis numbers to the colour yellow Console.Write(y + " "); Console.ResetColor(); for (int r = 0; r < Xaxis; r++) // Horizontal length of board { Console.ForegroundColor = ConsoleColor.Yellow; //changes Xaxis numbers to the colour yellow Console.Write(" " + r); Console.ResetColor(); Letterboard[y, r] = RandomLetter(rng) + " "; // Makes the board equal just random letters } } Console.WriteLine(); for (int L = 0; L < NumOfwords; L++) { Console.Clear(); Console.Write(" "); for (int r = 0; r < Xaxis; r++) // Horizontal length of board { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write(" " + r); Console.ResetColor(); } Console.WriteLine(); string SplitWords = Word[L].words; SplitWords.ToCharArray(); for (int y = 0; y < Yaxis; y++) // Vertical length of board { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write(y + " "); Console.ResetColor(); for (int r = 0; r < Xaxis; r++) // Horizontal length of board { for (int N = 0; N < SplitWords.Length; N++) // If statement loop adds letter of the word to the board depending on the direction its suppose to go in { if (Word[L].direction == "right" && y == Word[L].column && r == Word[L].row + N) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "left" && y == Word[L].column && r == Word[L].row + -N) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "down" && y == Word[L].column + N && r == Word[L].row) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "up" && y == Word[L].column + -N && r == Word[L].row) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "leftup" && y == Word[L].column + -N && r == Word[L].row + -N) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "rightup" && y == Word[L].column + -N && r == Word[L].row + N) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "leftdown" && y == Word[L].column + N && r == Word[L].row + -N) { Letterboard[y, r] = SplitWords[N] + " "; } if (Word[L].direction == "rightdown" && y == Word[L].column + N && r == Word[L].row + N) { Letterboard[y, r] = SplitWords[N] + " "; } } Console.Write(Letterboard[y, r]); } Console.WriteLine(); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("Words to find"); Console.ResetColor(); Console.WriteLine(); for (int k = 0; k < Word.Length; k++) { Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine(Word[k].words); } } Console.ReadKey(); }