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

  • Home
  • SEARCH
  • 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 8729781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:53:36+00:00 2026-06-13T08:53:36+00:00

I have been reading up on C++ lately, especially STL, and I decided to

  • 0

I have been reading up on C++ lately, especially STL, and I decided to do the Knights Tour problem again. I’m thinking about the best way to implement this, and I’m looking for some help.

Just for fun and practice, I thought I’d start with a “Piece” base class, which a “Knight” class can inherit from. I want to do this so I later can try adding other pieces(even though most of the pieces can’t walk over the whole board and complete the problem).

So the “piece class” will need some sort of container to store the coordinates of the piece on the board and the number of moves it has made in that specific step.

I’m thinking I need a linked list with 64 (8 * 8) places to do this most efficiently, containing x,y and moves.

Looking at the STL containers, I can’t find anything except map that will hold more than one type.

What can I do to store the coordinate pair and an int for the number of moves in one container? Are there more efficient ways of doing this than using vector, list or map? Do I need a custom container?

Thanks!

  • 1 1 Answer
  • 0 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-06-13T08:53:37+00:00Added an answer on June 13, 2026 at 8:53 am

    You can use

    struct CellInfo
    {
        int x, y, move_count;
    }
    

    And store it in std::vector for constant access.

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

Sidebar

Related Questions

I have been reading about unsafePerformIO lately, and I would like to ask you
Lately I have been reading a lot of blog topics about big sites(facebook, twitter,
Lately I have been reading about the Rack architecture in Passenger/Rails, and how it
I have been doing some catching up lately by reading about cloud hosting. For
I have been reading a lot about Reinforcement Learning lately, and I have found
I have been reading more lately about the efficiency of the different selector engines.
I have been reading about Factory pattern a lot lately. I am trying to
I have been reading a lot about Haskell lately, and the benefits that it
I have been reading a lot of articles lately about programming practice, design and
Lately I have been reading about web crawling, indexing and serving. I have found

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.