CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Slovenia (currently: Germany)
    Posts
    249

    A kingdom for a pattern!

    I am building an alife application using MFC. I have created a world and put inside little creatures. I have two objects concerning this situation. One is CWorld with methods that affect the entire population such as DestroyAllLife(), Genesis() and a list of all CCreature objects. The other is CCreature. An instance of CWorld is also a member of CDocument which acts as a controller. Now the problem I am trying to solve is how to couple classes CWorld and CCreature.

    For example: The world of my creatures is flat. Actually some of them think it is not flat but they are WRONG! It is a CRect object as flat as it can be. When a creature decides to go on a vacation it travels around the world. Eventually it comes to the edge of the world. But how will my poor creature know it has come to the edge of the world? If it asks the world he lives in about the edge of the world that is not compliant with the low coupling of objects.
    If it has a map (a knowledge about the world) it has an internal knowledge about another object.
    But the problems get even worse. My creature has feelings about other creatures. It can see and admire other creatures. It can hurd. It can even fell inlove with another creature and they produce new cute little creatures with chromosones being mixture of their genes.
    But how does my creature meet other creatures?
    How does it see them? How does a male creature see the beauty of a female creature?
    Again it can't ask world about it and it can't have it's own handbook with list of all interesting creatures with their phone numbers.
    Help! How would you organize these objects?
    I am so desperate that I am thinking about creating a CGod object which my little creatures could ask about anything they wish to know...

    ---------------------------------------------
    Tomaz Stih, B.Sc.CS [email protected]
    Ob sotoccju 10 Nameco Group
    SI-1000 Ljubljana http://www.nameco.com
    Europe



  2. #2
    Join Date
    Apr 1999
    Location
    Michigan, USA
    Posts
    115

    Re: A kingdom for a pattern!

    Check the C++ section of this site. It has a subsection on design paterns.


  3. #3
    Guest

    Re: A kingdom for a pattern!

    A few million years ago--after the '60s but before the '90s--the American magazine "Scientific American" published an article on pattern algorithms for a "cocktail party". Although the author was rather "tongue-in-cheek", the algorithms were valid and included topics such as spatial proximity, attraction (to other party-goers, the bar, and/or the buffet table) and basic goals/objectives (getting a date, getting drunk, eating). If you have access to a good library, you might be able to find a reprint of the article.

    Cheers!
    Humble Programmer
    ,,,^..^,,,


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured