write the c code for a roulette wheel in csharp

Here is a simple implementation of a Roulette Wheel game in C#:

main.cs
using System;

namespace RouletteWheel
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] pockets = new int[]
                {
                    0, 32, 15, 19, 4, 21,
                    2, 25, 17, 34, 6, 27,
                    13, 36, 11, 30, 8, 23,
                    10, 5, 24, 16, 33, 1,
                    20, 14, 31, 9, 22, 18,
                    29, 7, 28, 12, 35, 3, 26
                };
                Random random = new Random();
                int winningPocket = pockets[random.Next(0, pockets.Length - 1)];
                Console.WriteLine("Winning pocket is " + winningPocket);
                Console.WriteLine("Play again? (y/n)");
                string playAgain = Console.ReadLine();
                if (playAgain.ToLower() == "n")
                    break;
            }
            Console.WriteLine("Goodbye!");
            Console.ReadLine();
        }
    }
}
983 chars
33 lines

In this implementation, we define an array of integers that correspond to the pockets on the roulette wheel. We then randomly select a pocket using the Random class's Next() method, and display it to the player. The game continues until the player chooses to quit by entering "n".

gistlibby LogSnag