Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So ive started on this code to create a snakes and ladders game, what i need is to make players able to move through the 100 spaces in the array according to the dice i have set. i believe i am missing something in the Dice Method

C#
static char[,] CH_AR_Board = new char[10, 10];
       static int player1position = 1;
       static int player2position = 1;
       static string currentplayer;
       static string player1;
       static string player2;


       static void Main(string[] args)
       {

           Introduction();
           //DisplayBoard();
           while(player1position < 100 && player2position < 100)
           {

           }
           Dice(currentplayer);
           Console.ReadKey(true);
       }

       static void Introduction()
       {
           Console.Title = "Snakes And Ladders";
           Console.WriteLine("Welcome to Snakes And Ladders, A Simple Game\n");
           Console.WriteLine("Press Any Key To Continue");
           Console.ReadLine();
           Console.Clear();

           Console.WriteLine("Player 1 Enter Your Name\n ");
           player1 = Console.ReadLine();
           Console.WriteLine("Payer 2 Enter Your Name ");
           player2 = Console.ReadLine();
           Console.Clear();
       }

       static void Dice(string player)
       {
           Random rnd = new Random();
           int IN_random;
           IN_random = rnd.Next(1, 7);
           IN_random += player1position;
           Console.WriteLine("You Rolled A " + IN_random);
       }


What I have tried:

i dont know where to go from here
Posted
Updated 11-Jun-16 9:30am
v2
Comments
CHill60 11-Jun-16 14:41pm    
What do you think you are missing? You're not returning any value from the method. And in your main function you are only calling the method once for an undefined currentplayer.
How do you plan to note the location of each player? What do you think should be in the body of that loop that is currently completely empty?
You need to do a lot more work and come back when you hit a specific problem - we are not going to write the code for your assignment for you

1 solution

In addition to CHill60's comment here's a how-to-start-idea:

Snake Game[^]
 
Share this answer
 
Comments
George Jonsson 12-Jun-16 1:09am    
I think you link to a different kind of game.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900