//My main method. This method accesses the other classes and is where i store my reference variable that the other classes use. Its also where the turns //take place. I use multiple while loops with a number that decides what turn it is. static void Main() { //My Variables, some are elsewhere but all my referenced variables are here. //This is the variable used to detemine whether you face another player or a computer. int Player_Count = 0; //Turn Variable int turn = 1; //Both players initial Points. int P2_Point_Total = 5; int P1_Point_Total = 5; //This is used as an on/off switch for the game loop. int Game_State = 0; //These are the most important variables. These three methods determine the values for the board. And are referenced and changed alot throughout //the game. Cells_Number is the cells place on the board. Owned is either 0,1,2 depending on who owns it. And Cells_Size is the energy in that cell. int[,] Cells_Number = { { 0, 1, 2, 3, 4 }, { 5, 6, 7, 8, 9 }, { 10, 11, 12, 13, 14 }, { 15, 16, 17, 18, 19 }, { 20, 21, 22, 23, 24 } }; int[,] Owned = { { 1, 0, 0, 0, 2 }, { 1, 0, 0, 0, 2 }, { 1, 0, 0, 0, 2 }, { 1, 0, 0, 0, 2 }, { 1, 0, 0, 0, 2 } }; int[,] Cells_Size = { { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } }; //I call my intro method here. It is used mainly for checking if there are 1 or 2 players. Intro(ref Player_Count); //Game Loop, keeps game going till i stop it. while (Game_State == 0) { //This Changes what happens depending on player count. if (Player_Count == 1) { //This Changes what happens depending on turn. while (turn == 1) { //Here i call my GameBoard method, it draws out the board using the 3 arrays i have up top. GameBoard(turn, P1_Point_Total, P2_Point_Total, Owned, Cells_Size); //This is a method call from another class called Turn. Turn_Write is the method that makes the prompt for the player //to choose an gameplay option. Turn.Turn_Write(); //This is just a temp variable to allow the player to make their choice. I couldve done this in Turn_Write but didn't really care. string type = Console.ReadLine(); //This switch changes what happens depending on what option the player chooses. switch (type) { case "1": { //This called the Distribute method from the Turn class. I explain what all the methods do down where they are. Turn.Distribute(turn, ref P1_Point_Total, ref Cells_Size, ref Owned); break; } case "2": { //Calls Move method from Turn class. Turn.Move(turn, ref Owned, ref Cells_Number, ref Cells_Size); break; } case "3": { //Just changes turn to 2. turn = 2; break; } case "Cheat": { //I put this in for debugging to give me points to use. Turn.Cheat(ref Cells_Size, ref Owned); break; } } //This is here as a buffer, it allows the playre to look at the board before moving on. They can press enter when they are ready to. Console.WriteLine("Press Enter to Continue."); Console.ReadLine(); //GameBoard method again. GameBoard(turn, P1_Point_Total, P2_Point_Total, Owned, Cells_Size); Console.Clear(); } //This is what happens on turn 2. This is in the 1 player version so its a computer. while (turn == 2) { //Calls Distribute method again, but this time from the Comp class, does the same thing but is randomized. Comp.Distribute(ref P2_Point_Total, Owned, ref Cells_Size); //Calls Move method from Comp class. Comp.Move(ref Owned, ref Cells_Size, Cells_Number); //Changes turn to 3 turn = 3; } //Turn 3 is my ending of the round turn. Its where i apply changes to the players. while (turn == 3) { //Calls Turn_End method from Turn class, it takes the total amount of cells you own and gives you 1 point for each to your total. //Then it adds 1 energy to each cell you own. It also checks every round if someone owns all the cells, then ends the game. Turn.Turn_End(ref Game_State, Owned, ref P1_Point_Total, ref P2_Point_Total, ref Cells_Size); //Changes back to turn 1. turn = 1; } } //This is if there are 2 players. So you face another person not the computer. if (Player_Count == 2) { //What happens if its turn 1. while (turn == 1) { //Calls GameBoard Method. GameBoard(turn, P1_Point_Total, P2_Point_Total, Owned, Cells_Size); //Calls Turn_Write Method from Turn class. Turn.Turn_Write(); string type = Console.ReadLine(); switch (type) { case "1": { //Calls Distribute Method from Turn class. Turn.Distribute(turn, ref P1_Point_Total, ref Cells_Size, ref Owned); break; } case "2": { //Calls Move Method from Turn class. Turn.Move(turn, ref Owned, ref Cells_Number, ref Cells_Size); break; } case "3": { //Makes it turn 2. turn = 2; break; } case "Cheat": { Turn.Cheat(ref Cells_Size, ref Owned); break; } } Console.WriteLine("Press Enter to Continue."); Console.ReadLine(); GameBoard(turn, P1_Point_Total, P2_Point_Total, Owned, Cells_Size); Console.Clear(); } //Exact copy of turn 1, excpet changed to affect player 2's side. while (turn == 2) { GameBoard(turn, P1_Point_Total, P2_Point_Total, Owned, Cells_Size); Turn.Turn_Write(); string type = Console.ReadLine(); switch (type) { case "1": { Turn.Distribute(turn, ref P2_Point_Total, ref Cells_Size, ref Owned); break; } case "2": { Turn.Move(turn, ref Owned, ref Cells_Number, ref Cells_Size); break; } case "3": { turn = 3; break; } case "Cheat": { Turn.Cheat(ref Cells_Size, ref Owned); break; } } Console.WriteLine("Press Enter to Continue."); Console.ReadLine(); GameBoard(turn, P1_Point_Total, P2_Point_Total, Owned, Cells_Size); Console.Clear(); } //What happens on end of round. while (turn == 3) { Turn.Turn_End(ref Game_State, Owned, ref P1_Point_Total, ref P2_Point_Total, ref Cells_Size); turn = 1; } } } Console.ReadLine(); }