예제 #1
0
def main():
    timestamp_name = str(datetime.today()) + ".png"
    parser = argparse.ArgumentParser(description="""A small program to generate
                    simple terrains using seed growing""")
    parser.add_argument("-width", "-w", default=500, type=int, dest="width",
            help="The width of the generated image - default is 500")
    parser.add_argument("-height", "-he", default=500, type=int, dest="height",
            help="The height of the generated image - default is 500")
    parser.add_argument("-growth-threshold", "-g", default=0.9, type=float,
            dest="growth_threshold", help="""The growth threshold above which a
            seed stops growing - default is 0.9""")
    parser.add_argument("-decay-rate", "-d", default=0.01, type=float,
            dest="decay", help="""The rate at which the growth threshold
            decreases - default is 0.01""")
    parser.add_argument("-number-of-seeds", "-n", default=10, type=int,
            dest="num_seeds", help="""The number of seeds to grow land from -
            default is 10""")
    parser.add_argument("-filename", "-f", default=timestamp_name, dest="filename",
            help="The output filename - default is random")
    parser.add_argument("-verbose", "-v", action='store_true', dest='verbose',
            help="Should the recursion depth be shown? - default is true")

    args = parser.parse_args()

    #width, height, growth threshold, decay rate, number of seeds
    tg = TerrainGenerator(args.width, args.height, args.growth_threshold,
            args.decay, args.num_seeds, args.filename)
    
    tg.generate_terrain()

    if args.verbose:
        print "Recursion depth: " + str(tg.get_recursion_depth())
        print "Output filename: " + args.filename
예제 #2
0
def main():
    parser = argparse.ArgumentParser(
        description=
        "A small program to generate simple terrains using seed growing")

    parser.add_argument(
        "-width",
        "-w",
        default=500,
        type=int,
        dest="width",
        help="The width of the generated image - default is 500")
    parser.add_argument(
        "-height",
        "-he",
        default=500,
        type=int,
        dest="height",
        help="The height of the generated image - default is 500")
    parser.add_argument(
        "-growth-threshold",
        "-g",
        default=0.9,
        type=float,
        dest="growth_threshold",
        help=
        "The growth threshold above which a seed stops growing - default is 0.9"
    )
    parser.add_argument(
        "-decay-rate",
        "-d",
        default=0.01,
        type=float,
        dest="decay",
        help=
        "The rate at which the growth threshold decreases - default is 0.01")
    parser.add_argument(
        "-number-of-seeds",
        "-n",
        default=10,
        type=int,
        dest="num_seeds",
        help="The number of seeds to grow land from - default is 10")
    parser.add_argument("-filename",
                        "-f",
                        default="map.png",
                        dest="filename",
                        help="The output filename - default is map.png")

    arguments = vars(parser.parse_args())

    #width, height, growth threshold, decay rate, number of seeds
    tg = TerrainGenerator(arguments['width'], arguments['height'],
                          arguments['growth_threshold'], arguments['decay'],
                          arguments['num_seeds'], arguments['filename'])
    tg.generateTerrain()
예제 #3
0
def main():
	parser = argparse.ArgumentParser(description="A small program to generate simple terrains using seed growing")

	parser.add_argument("-width", "-w", default=500, type=int, dest="width", help="The width of the generated image - default is 500")
	parser.add_argument("-height", "-he", default=500, type=int, dest="height", help="The height of the generated image - default is 500")
	parser.add_argument("-growth-threshold", "-g", default=0.9, type=float, dest="growth_threshold", help="The growth threshold above which a seed stops growing - default is 0.9")
	parser.add_argument("-decay-rate", "-d", default=0.01, type=float, dest="decay", help="The rate at which the growth threshold decreases - default is 0.01")
	parser.add_argument("-number-of-seeds", "-n", default=10, type=int, dest="num_seeds", help="The number of seeds to grow land from - default is 10")
	parser.add_argument("-filename", "-f", default="map.png", dest="filename", help="The output filename - default is map.png")

	arguments = vars(parser.parse_args())
	
	#width, height, growth threshold, decay rate, number of seeds
	tg = TerrainGenerator(arguments['width'], arguments['height'], arguments['growth_threshold'], arguments['decay'], arguments['num_seeds'], arguments['filename'])
	tg.generateTerrain()
예제 #4
0
def main():
    timestamp_name = str(datetime.today()) + ".png"
    parser = argparse.ArgumentParser(description="""A small program to generate
                    simple terrains using seed growing""")
    parser.add_argument(
        "-width",
        "-w",
        default=500,
        type=int,
        dest="width",
        help="The width of the generated image - default is 500")
    parser.add_argument(
        "-height",
        "-he",
        default=500,
        type=int,
        dest="height",
        help="The height of the generated image - default is 500")
    parser.add_argument("-growth-threshold",
                        "-g",
                        default=0.9,
                        type=float,
                        dest="growth_threshold",
                        help="""The growth threshold above which a
            seed stops growing - default is 0.9""")
    parser.add_argument("-decay-rate",
                        "-d",
                        default=0.01,
                        type=float,
                        dest="decay",
                        help="""The rate at which the growth threshold
            decreases - default is 0.01""")
    parser.add_argument("-number-of-seeds",
                        "-n",
                        default=10,
                        type=int,
                        dest="num_seeds",
                        help="""The number of seeds to grow land from -
            default is 10""")
    parser.add_argument("-filename",
                        "-f",
                        default=timestamp_name,
                        dest="filename",
                        help="The output filename - default is random")
    parser.add_argument(
        "-verbose",
        "-v",
        action='store_true',
        dest='verbose',
        help="Should the recursion depth be shown? - default is true")

    args = parser.parse_args()

    #width, height, growth threshold, decay rate, number of seeds
    tg = TerrainGenerator(args.width, args.height, args.growth_threshold,
                          args.decay, args.num_seeds, args.filename)

    tg.generate_terrain()

    if args.verbose:
        print "Recursion depth: " + str(tg.get_recursion_depth())
        print "Output filename: " + args.filename
예제 #5
0
def main():
	#width, height, growth threshold, decay rate, number of seeds
	tg = TerrainGenerator(700, 500, 0.9, 0.001, 10) 
	tg.generateTerrain()