Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3243858
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:28:57+00:00 2026-05-17T18:28:57+00:00

I am currently implementing something quite similar to checkers. So, I have this table

  • 0

I am currently implementing something quite similar to checkers. So, I have this table game and there are both white and black pieces. Where there are neither white or black pieces, you dno’t have pieces.

I’m currently doing the GetValidMoves() method that’ll return all the current moves one can do with the current board.

I am thus wondering what might be the best way to represent the board. The naive approach would be to have a matrix with 0’s 1’s and 2’s (for no piece, white piece and black piece).

Other idea would be to instead of a matrix representation of the board, have 2 lists(or any other data-structure): one for black pieces, other for white.

I am implementing this game to test some AI algorithms, so my main concern is speed. I will basically put 2 AI players playing each other, for each turn each player should have a list of all his valid moves and then he’ll choose what move to do, this always happening until the game ends(some player wins or there’s a tie).

PS: I am not asking about the AI algorithm, I just want to know what would be the best data-structure to handle the board, so that it makes it easy to

  1. Look for all the valid moves for the current player
  2. Do a move
  3. Verify the game is not over (it is over when one player lost all his pieces or one player reached the other side of the board).
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:28:57+00:00Added an answer on May 17, 2026 at 6:28 pm

    Consider using a bitmap: two 64-bit unsigned ints, one for white and one for black. Then you can represent moves and board positions as a function from (W x B) -> (W x B) where W, B represent the set of possible white and possible black positions respectively.

    Then most of the board position stuff can be done with integer arithmetic, which is about as fast as you can get.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently implementing something similar to an hospital intra site, where doctors can
I'm currently implementing a HTML canvas based webapp that features panning. Is there a
I'm currently implementing a client application that POST's a file over HTTP and have
We currently have quite a few classes in a project, and each of those
I am currently implementing a form in CodeIgniter that needs to have a drop
I'm currently implementing the Factory design pattern in Python and I have a few
I'm currently implementing a red-black tree data structure to perform some optimizations for an
I have a table: TRADESHOW id name industry Where industry is currently listed as
I realize that there are other posts asking similar questions, but do not quite
We're currently implementing a little tag system into our software. There are just two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.