1. Home
  2. Computing & Technology
  3. C / C++ / C#

Programming Challenge 18 - Generate a Map

By David Bolton, About.com

I have written a number of map generators during my game programming career, the first one was in Z80 assembler. In this contest, you have to write a generator. This competition is more qualitative than quantitative so there's no speed element. I'll be judging on how nice the maps look!

The Map Specification

The map is 80 characters wide by 50 tall and wraps East-west. If you were to print it out and fasten the shorter edges together, you'd have a cylinder that has a 80 circumference by 50 high.

The map should consist of between 3 and 5 islands but no island should come within 2 locations of the north or south edges. It's ok for them to overlap East West etc. Each island should be no bigger than 400 locations or smaller than 50 locations so there will be more sea than land. Islands can be any shape. I'll give more marks if they are not circular, rectangular or square. An island is considered any land location that is contiguous to another land location, (ie next to it horizontally or vertically).

There should be no lakes smaller than 10 locations in size. If there are fill them in or you lose points. Likewise no islands less than 50.

Terrain

Use a + for a land location and a full stop . for sea. Please make 20% of the land locations as clumps of forest (use a * ) and 15% are mountains (Use A ^ ).

Entries

Please create a text file with 10 different maps, each 80 x 50. After each map output one line per island like this. Island 1: 345 locations. Island 2: .... That's it!

Results

There were two entries from Vikas Ranjane in C and Kenneth D. Weinert in C#.

I think Kenneth's maps are more interesting so he is the winner but judge for yourself. Here are the maps produced:

Thanks to both entrants!

More Programming Challenges

Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. Projects
  5. Programming Challenges
  6. Programming Challenge 18 - Map Generator - Completed>

©2009 About.com, a part of The New York Times Company.

All rights reserved.