#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Map generator in C (text mode)


    Hi, I'm new in c language (I'm beginner in programming as well). I have to write some program in c on ma IT classes:

    "Map generator
    Generator of random “maps”, e.g. for a game, represented using characters (“text mode”), with areas of water, grass, trees, hills, and mountains (there could be more). Each type of terrain has an appropriate character. A map is displayed on screen and saved to a file. Map size, land to water ratio, and smoothness of area edges should be user-defined."

    I think I can handle this part with displaying and saving, but could You give me some advices/methods/ideas how to solve this last part: "Map size land to water ratio, and smoothness of area edges should be user-defined."

    Thanks in advance
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,381
    Rep Power
    1871
    > "Map size land to water ratio, and smoothness of area edges should be user-defined."

    1. Keep a count of how many "L" and "W" symbols you use.

    2. For smoothness, consider something like this.

    This is smooth, because it has 5 neighbours

    WWWWW
    LLLLL
    LLLLL


    This is less smooth, because it only has three neighbours

    WWWWWW
    LLLLLW
    LLLLLW
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo