Click here to Skip to main content
15,899,474 members
Home / Discussions / C#
   

C#

 
GeneralRe: Most efficient switch statement variable to use? Pin
PIEBALDconsult24-Feb-09 15:15
mvePIEBALDconsult24-Feb-09 15:15 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot24-Feb-09 15:42
harold aptroot24-Feb-09 15:42 
Questionapp.config file Pin
rcwoods24-Feb-09 6:17
rcwoods24-Feb-09 6:17 
QuestionSaving and loading a file Pin
bar300024-Feb-09 5:31
bar300024-Feb-09 5:31 
AnswerRe: Saving and loading a file Pin
CPallini24-Feb-09 5:39
mveCPallini24-Feb-09 5:39 
AnswerRe: Saving and loading a file Pin
Paul Kettley24-Feb-09 6:12
Paul Kettley24-Feb-09 6:12 
GeneralRe: Saving and loading a file Pin
Jon Rista24-Feb-09 6:21
Jon Rista24-Feb-09 6:21 
AnswerRe: Saving and loading a file Pin
Luc Pattyn24-Feb-09 7:23
sitebuilderLuc Pattyn24-Feb-09 7:23 
Hi,

I reckon checkers state is rather limited: to me it is what you see on the board (50 squares being empty, or taken by white, black, white queen, black queen) plus ply (=half move) number.

Internally I would be inclined to store the board state in bitmaps (not the GDI ones!_, being long integers where each bit represents one square. Possible variables might be: white, black, queen, and empty (which would be redundant but might speed up things).

The advantage of bitmaps is they allow you to generate possible moves in parallel by:
- performing shifts, e.g. (newState = oldState << 1) could be a forward move right
- then mask or AND to discard moves to non-empty squares, etc.

So what is keeping you from saving/restoring those few longs?

BTW: I would NEVER use PictureBoxes to render the board of a board game. I'd rather use a single Panel
and paint the squares and pieces myself in its Paint handler.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles]

- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


modified on Sunday, June 12, 2011 8:36 AM

GeneralRe: Saving and loading a file Pin
PIEBALDconsult24-Feb-09 7:37
mvePIEBALDconsult24-Feb-09 7:37 
QuestionVSTO Outlook 2007 Pin
staticv24-Feb-09 4:14
staticv24-Feb-09 4:14 
AnswerRe: VSTO Outlook 2007 Pin
Calin Tatar24-Feb-09 4:34
Calin Tatar24-Feb-09 4:34 
GeneralRe: VSTO Outlook 2007 Pin
staticv24-Feb-09 4:40
staticv24-Feb-09 4:40 
QuestionExposing an already running singlton .NET component as COM server Pin
Omer S.24-Feb-09 4:05
Omer S.24-Feb-09 4:05 
Questionstd::string version in C# - Question Pin
Programm3r24-Feb-09 3:34
Programm3r24-Feb-09 3:34 
AnswerRe: std::string version in C# - Question Pin
EliottA24-Feb-09 3:43
EliottA24-Feb-09 3:43 
AnswerRe: std::string version in C# - Question Pin
musefan24-Feb-09 3:45
musefan24-Feb-09 3:45 
AnswerRe: std::string version in C# - Question Pin
PIEBALDconsult24-Feb-09 3:46
mvePIEBALDconsult24-Feb-09 3:46 
AnswerRe: std::string version in C# - Question Pin
Eddy Vluggen24-Feb-09 3:57
professionalEddy Vluggen24-Feb-09 3:57 
QuestionShow Form and Disable Button How? Pin
soulidentities24-Feb-09 2:59
soulidentities24-Feb-09 2:59 
AnswerRe: Show Form and Disable Button How? Pin
musefan24-Feb-09 3:41
musefan24-Feb-09 3:41 
GeneralRe: Show Form and Disable Button How? Pin
soulidentities24-Feb-09 3:56
soulidentities24-Feb-09 3:56 
GeneralRe: Show Form and Disable Button How? Pin
musefan24-Feb-09 4:26
musefan24-Feb-09 4:26 
GeneralRe: Show Form and Disable Button How? Pin
soulidentities24-Feb-09 5:58
soulidentities24-Feb-09 5:58 
AnswerRe: Show Form and Disable Button How? Pin
DaveyM6924-Feb-09 4:43
professionalDaveyM6924-Feb-09 4:43 
AnswerRe: Show Form and Disable Button How? Pin
Paul Kettley24-Feb-09 6:16
Paul Kettley24-Feb-09 6:16 

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.