Thread: Eight by Eight Grid with Assignable Values?

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    2

    Question Eight by Eight Grid with Assignable Values?

    I was wondering if someone could help me to represent an eight by eight grid that can have multiple assigned values to each square. If I can get this part figured out - I can start to figure on how to implement the entire design of my program. I am really a very begginer and know VERY little - so the more detailed information and commentation: the better. Any help would be greatly appriciated. Thank you very much. P.S. - Adaptability is the main thing I am looking for. Thanks again.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Well, there are probably 50 ways to do what you want, and your access patterns to the data would probably help dictate the better ways.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    How to go about this all depends on the details.

    When you write code, you have your own little "universe", so nearly anything can be done, assuming you have the memory to hold your data, of course.

    The devil, as they say, is indeed in the details.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What sort of "multiple assigned values". And as others have said: How are you going to use the data? Is there a set number of possible values, or value types? Are all value types always used, or only one type of value at a time?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Simply use Arrays:

    [CODE]int Array[8][8];[CODE]
    This holds 8 * 8 = 64 ints.

    There are many tutorials about those there. Just google ("c array tutorial")

  6. #6
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by Brafil View Post
    Simply use Arrays:

    [CODE]int Array[8][8];[CODE]
    This holds 8 * 8 = 64 ints.

    There are many tutorials about those there. Just google ("c array tutorial")
    Sure, that would be fine if these "multiple values" it needs to hold are bitflags
    The problem is a lack of information from the original poster. "Multiple" could mean 2, up to 3, exactly 13, over 200, up to 100000, or an unknown number. I would probably do something different for each one of those cases!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-30-2007, 10:08 AM
  2. Need help with project
    By chrisa777 in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2006, 05:01 PM
  3. More Windows Trouble
    By samGwilliam in forum Windows Programming
    Replies: 9
    Last Post: 04-12-2005, 10:02 AM
  4. Find a word in a 2d grid
    By The_Kingpin in forum C++ Programming
    Replies: 2
    Last Post: 02-24-2005, 05:38 PM
  5. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM