Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm starting to make a checkers game and I've got all my graphics + the board drawn. Before I moved on to creating the pieces I was wondering what an easy way to tackle the logic side of the movement of pieces.. Should I make a table of every square, detecting if it has a piece and if so, what color? (i.e 0=empty, 1=red, 2=black) or do you guys have a better idea to this issue? Thanks in advance.

share|improve this question

closed as not constructive by Byte56, doppelgreener, bummzack, Nicol Bolas, Josh Petrie Oct 19 '12 at 17:38

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1. Learn to play checkers. 2. Write down on piece of paper checkers rules (don't copy them, write them by yourself). 3. Try to design how you could program it, and write it on a piece of paper as well. 4. Try to actually program it. 5. If you get a problem holding you for a day, ask here. Programming is about creating solutions, this site is not to create solutions for others but to help them when they fail. – Markus von Broady Oct 12 '12 at 20:17
The way you're asking this, you're just going to get a discussion. Can you elaborate more on what strategy you want to use, what you've tried already, what isn't working? Try drawing it out on paper or use a real checkers board and imagine how you would implement that in an object oriented way. – Byte56 Oct 12 '12 at 20:17

I'd just have a two dimensional array of Space objects. Don't know how you're rendering each space, but the Space object could say if it's occupied by a piece, and if so, what is the color, etc.

share|improve this answer
that would be predifined, right? Or maybe I could write a for loop for that.. – Chris Oct 12 '12 at 20:07
if you mean the board would be predefined, yeah i guess, just depends on what you want to do. Like the comments are saying, there are many ways to skin a cat, just gotta choose the way you are comfortable with and go with it. – dardo Oct 14 '12 at 20:57
Hi @dardo. I edited out the "just my 2c" line - every answer here is just somoene's 2c. ;) – doppelgreener Oct 19 '12 at 1:11
WHAT! ok =) thanks – dardo Oct 19 '12 at 4:40

I once wrote a reversi game and I just used a table of values for each square and it worked fine assigning a number to each possible state. When you move a piece you would have a function that would check if a move is legal then erase where the piece from one square and put it in the next one. I'm sorry if I missed something applicable but I don't actually know how to play checkers.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.