Thread: Something like a game

  1. #1
    Registered User Makaila's Avatar
    Join Date
    Oct 2009
    Posts
    10

    Question Something like a game

    Hi!
    I've got an assignment to make a word association game.
    It should look like this: 5 main items that are the final solutions for 5 games, 4 sub items that describe each of the main items and 3 different associations for each of this 4 sub items.

    a) association1 a) association1 a) association1 a) association1
    b) association2 b) association2 b) association2 b) association2
    c) association3 c) association3 c) association3 c) association3
    sub item 1 sub item 2 sub item 3 sub item 4
    main item

    I was thinking to make a structure items, which would contain an array with the names of sub items and an array with all associations for those items. Like this:
    MAX is defined constant

    Code:
    struct items
    {
         char subitems[4][MAX], item_name[MAX], association[5][MAX];
        
    };
    
    main()
    {
         struct items item[5];
    }
    If anybody has an idea that would be more appropriate, please comment. My main problem are the associations, because I have to separate 3 of them for each sub item.
    Last edited by Makaila; 12-14-2009 at 02:48 PM.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I would have the association items kept by index numbers or pointers. So you'd have:

    Code:
    Main Items  assoc.1 idx or ptr, assoc.2 idx or ptr, assoc.3.idx or ptr
    
    Have the associated word in a separate char word[idx][] array or string literal
    You can probably do it as you suggested, but work to avoid having multiple copies of each of the associated words. Use either pointers or index numbers, instead.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Replies: 15
    Last Post: 10-20-2009, 09:39 AM
  3. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  4. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

Tags for this Thread