using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace exampleChess
{
class Program
{
static void Main(string[] args)
{
Random random1 = new Random();
for (int i = 0; i < 3; i++)
{
enum color { black, white};
enum chess { pawn, knight, bishop, rook, king, queen};
color colors = random1.Next(0, 2);
chess pieces = random1.Next(0, 6);
Console.WriteLine(colors + " " + pieces);
}
}
}}
wim haes2 pointsPosted Mar 24, 2010, 2:47 PM EDT
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace exampleChess
{
enum color { black, white};
enum chess { pawn, knight, bishop, rook, king, queen};
class Program
{
static void Main(string[] args)
{
Random random1 = new Random();
for (int i = 0; i < 3; i++)
{
color colors = (color) random1.Next(0, 2);
chess pieces = (chess) random1.Next(0, 6);
Console.WriteLine(colors + " " + pieces);
}
}
}
}
So this is the right code. First of all you need to put enums before you class. Second of all you need to cast the randoms to your enums.
Good luck.
Hirendra SisodiyaRank #256 · 9.8K pointsPosted Mar 24, 2010, 9:44 PM EDT