Click here to Skip to main content
15,885,141 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using Deployment Item with Directory.GetFiles Pin
Eddy Vluggen1-Apr-16 1:33
professionalEddy Vluggen1-Apr-16 1:33 
Questioncurrent state of old issue of Enum boxing when used as Keys in a Dictionary ? Pin
BillWoodruff31-Mar-16 2:15
professionalBillWoodruff31-Mar-16 2:15 
AnswerRe: current state of old issue of Enum boxing when used as Keys in a Dictionary ? Pin
Richard Deeming31-Mar-16 2:52
mveRichard Deeming31-Mar-16 2:52 
QuestionMessage Removed Pin
31-Mar-16 0:25
PomegranateTiger31-Mar-16 0:25 
QuestionSync SQLite with Oracle or Postgre Pin
Potestas30-Mar-16 21:42
Potestas30-Mar-16 21:42 
AnswerRe: Sync SQLite with Oracle or Postgre Pin
Nathan Minier31-Mar-16 1:26
professionalNathan Minier31-Mar-16 1:26 
QuestionC# Tic Tac Toe "Simulator" Pin
Member 1242680830-Mar-16 11:24
Member 1242680830-Mar-16 11:24 
AnswerRe: C# Tic Tac Toe "Simulator" Pin
Sascha Lefèvre30-Mar-16 17:15
professionalSascha Lefèvre30-Mar-16 17:15 
The problem is that there's no context for the random values generation. You generate each 0 or 1 irrespective of how many there already are. So you need a method that ensures that there are either four 0's and five 1's or the other way around. There are several ways to do that. Here are two:

a) Create a one-dimensional array with a length of nine and fill it either with four or five 1's (the other indices are 0 by default and to decide whether it will be four or five 1's you can use Random.Next(4, 6) ). Then randomly swap the values of two indices multiple times. Then fill the values from that one-dimensional array into your two-dimensional game[3,3]-array.

b) Create an array of nine random numbers with no explicit upper bound (so the maximum value will be Int32.MaxValue). For the first four or five of those numbers, set the least significant bit (LSB) to 0 and for the remaining values, set it to 1. Then sort the array by values. Then fill the two-dimensional game-array based on the values from the sorted array but take only the value of the LSB.

There's something more to say about your code but, as I have to finish, I'll do that later if nobody else did until then.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

AnswerRe: C# Tic Tac Toe "Simulator" Pin
Rob Philpott30-Mar-16 23:41
Rob Philpott30-Mar-16 23:41 
AnswerRe: C# Tic Tac Toe "Simulator" Pin
Patrice T31-Mar-16 0:55
mvePatrice T31-Mar-16 0:55 
RantREPOST Pin
Richard Deeming31-Mar-16 1:42
mveRichard Deeming31-Mar-16 1:42 
QuestionDynamically close DB2 CLP window using C# Pin
Tej_dev30-Mar-16 6:44
Tej_dev30-Mar-16 6:44 
AnswerMessage Closed Pin
30-Mar-16 7:19
mveGerry Schmitz30-Mar-16 7:19 
GeneralRe: Dynamically close DB2 CLP window using C# Pin
Tej_dev30-Mar-16 8:14
Tej_dev30-Mar-16 8:14 
SuggestionRe: Dynamically close DB2 CLP window using C# Pin
Richard Deeming30-Mar-16 8:44
mveRichard Deeming30-Mar-16 8:44 
GeneralMessage Closed Pin
30-Mar-16 8:52
mveGerry Schmitz30-Mar-16 8:52 
GeneralRe: Dynamically close DB2 CLP window using C# Pin
Richard Deeming30-Mar-16 8:54
mveRichard Deeming30-Mar-16 8:54 
AnswerRe: Dynamically close DB2 CLP window using C# Pin
Richard Deeming30-Mar-16 8:52
mveRichard Deeming30-Mar-16 8:52 
GeneralRe: Dynamically close DB2 CLP window using C# Pin
Tej_dev30-Mar-16 9:03
Tej_dev30-Mar-16 9:03 
QuestionBitmap to BitmapImage Conversion Not Working - WPF Pin
AmbiguousName30-Mar-16 4:36
AmbiguousName30-Mar-16 4:36 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
Rob Philpott30-Mar-16 5:46
Rob Philpott30-Mar-16 5:46 
GeneralRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
AmbiguousName30-Mar-16 6:04
AmbiguousName30-Mar-16 6:04 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
Matt T Heffron30-Mar-16 6:54
professionalMatt T Heffron30-Mar-16 6:54 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
Gerry Schmitz30-Mar-16 7:06
mveGerry Schmitz30-Mar-16 7:06 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
V.31-Mar-16 3:42
professionalV.31-Mar-16 3:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.