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 8549187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:40:09+00:00 2026-06-11T13:40:09+00:00

I am designing a C++ console program that models a board of Shapes .

  • 0

I am designing a C++ console program that models a board of Shapes. The only rule is that all Shapes that are placed on the board have to be added to an existing Line (with the exception of the first move). Whenever a Shape is placed on the board, it has a Line in both the horizontal and vertical direction, even if it is the only member of the line.

I have implemented the Line and Shape objects fine. The issue I am struggling with is how to organize the lines. It didn’t seem like a good idea to give the line a position (as in a x,y coordinate), because the board is dynamic and can expand in any direction. Right now each line only has a direction, vertical or horizontal. I also need to be able to print the board to the console, so the user can indicate where they want to add on.

Does anyone have any ideas for how to model this situation efficiently?

  • 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-11T13:40:11+00:00Added an answer on June 11, 2026 at 1:40 pm

    It’s not completely clear what the rules are, but if you’re concerned about a freely expanding grid, you could consider storing the Shape objects in a map:

    typedef std::pair<int,int> TGridPos;
    typedef std::map<TGridPos,Shape> TGrid;
    

    Perhaps you could elaborate more on the gameplay.

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

Sidebar

Related Questions

I have: existing object oriented native code API (non GUI) GUI application that works
I'm designing a system that will be on-line in 2016 and run on commodity
When designing a C API for configuring a library/utility, I have a co-worker who
When designing a form I have the option of putting a close button at
I'm designing a console application for the first time in my career. This console
Suppose that I have two data types Foo and Bar. Foo has fields x
I'm designing a client side script that will read an XML file and display
I have a console based MEF application the host ( CompositionContainer ) of which
I have a very simple WCF program where I have a simple self-host and
I have recently programmed a console application and I've experienced a lot of pain

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.