Click here to Skip to main content
15,917,709 members
Home / Discussions / C#
   

C#

 
QuestionArray list question Pin
dennis_max279-Dec-09 23:37
dennis_max279-Dec-09 23:37 
AnswerRe: Array list question Pin
Rob Philpott10-Dec-09 0:22
Rob Philpott10-Dec-09 0:22 
AnswerRe: Array list question Pin
dennis_max2710-Dec-09 1:32
dennis_max2710-Dec-09 1:32 
AnswerRe: Array list question Pin
Keith Barrow10-Dec-09 1:39
professionalKeith Barrow10-Dec-09 1:39 
AnswerRe: Array list question Pin
Luc Pattyn10-Dec-09 1:58
sitebuilderLuc Pattyn10-Dec-09 1:58 
GeneralRe: Array list question Pin
dennis_max2710-Dec-09 2:22
dennis_max2710-Dec-09 2:22 
GeneralRe: Array list question Pin
Luc Pattyn10-Dec-09 2:43
sitebuilderLuc Pattyn10-Dec-09 2:43 
AnswerRe: Array list question Pin
PIEBALDconsult10-Dec-09 5:57
mvePIEBALDconsult10-Dec-09 5:57 
Ha! Use a System.Collections.Generic.HashSet! Big Grin | :-D

Are you only looking for a large straight?

Clear the HashSet.
Generate the numbers (into an array).
Iterate the array, putting each value in the HashSet. (Or you could eliminate the array if you're only interested in large straights.)
Check how many values are in the HashSet -- if there are five and 1 or 6 is not present, then you have a large straight!

To also check for small straights, you can track the min and max values.
Large straight := Five values, max - min == 4
Small straight := Four values, max - min == 3

Also, if the HashSet contains only one value, you have a Yahtzee.

If only two, you might have a full house.
QuestionSyntax error (missing operator) in query expression Pin
AlucardCode9-Dec-09 22:40
AlucardCode9-Dec-09 22:40 
AnswerRe: Syntax error (missing operator) in query expression Pin
OriginalGriff9-Dec-09 23:06
mveOriginalGriff9-Dec-09 23:06 
AnswerRe: Syntax error (missing operator) in query expression Pin
Ghydo9-Dec-09 23:17
Ghydo9-Dec-09 23:17 
GeneralRe: Syntax error (missing operator) in query expression Pin
AlucardCode9-Dec-09 23:34
AlucardCode9-Dec-09 23:34 
AnswerRe: Syntax error (missing operator) in query expression Pin
Scott Knestrick10-Dec-09 17:21
Scott Knestrick10-Dec-09 17:21 
QuestionBegin Invoke Example Pin
sureshhi9-Dec-09 22:33
sureshhi9-Dec-09 22:33 
AnswerRe: Begin Invoke Example: My Vote of 1 Pin
Keith Barrow9-Dec-09 23:38
professionalKeith Barrow9-Dec-09 23:38 
JokeRe: Begin Invoke Example Pin
Richard MacCutchan9-Dec-09 23:38
mveRichard MacCutchan9-Dec-09 23:38 
Questiondatabase Pin
farokhian9-Dec-09 22:24
farokhian9-Dec-09 22:24 
AnswerRe: database Pin
Eddy Vluggen10-Dec-09 0:35
professionalEddy Vluggen10-Dec-09 0:35 
AnswerRe: database Pin
Vimalsoft(Pty) Ltd10-Dec-09 2:08
professionalVimalsoft(Pty) Ltd10-Dec-09 2:08 
AnswerRe: database Pin
PIEBALDconsult10-Dec-09 4:01
mvePIEBALDconsult10-Dec-09 4:01 
QuestionToo many namespaces in a class Pin
Abhinav S9-Dec-09 22:07
Abhinav S9-Dec-09 22:07 
AnswerRe: Too many namespaces in a class Pin
Migounette9-Dec-09 22:17
Migounette9-Dec-09 22:17 
AnswerRe: Too many namespaces in a class Pin
jdkulkarni9-Dec-09 22:20
jdkulkarni9-Dec-09 22:20 
GeneralRe: Too many namespaces in a class Pin
PIEBALDconsult10-Dec-09 3:56
mvePIEBALDconsult10-Dec-09 3:56 
AnswerRe: Too many namespaces in a class Pin
Richard MacCutchan9-Dec-09 23:40
mveRichard MacCutchan9-Dec-09 23:40 

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.