Exemple #1
0
import argparse
import cellular

parser = argparse.ArgumentParser()
parser.add_argument('--ticks', action='store', default=60)
parser.add_argument('--slope_length', action='store', default=450)
parser.add_argument('--ticks_per_delivery', action='store', default=30)
parser.add_argument('--delivery_zone', action='store', default=10)
parser.add_argument('--coverage', action='store', default=0.15)
parser.add_argument('--singlelayer_speed', action='store', default=0.3)
parser.add_argument('--multilayer_speed', action='store', default=0.7)
parser.add_argument('--flat_speed', action='store', default=0.2)
parser.add_argument('--drop_zone', action='store', default=6)
parser.add_argument('--gridx', action='store', default=640)
parser.add_argument('--gridy', action='store', default=480)
args = parser.parse_args()

grid = cellular.init_grid(args.gridx, args.gridy, coverage=args.coverage)
cellular.run(grid,
             ticks=args.ticks,
             slope_length=args.slope_length,
             ticks_per_delivery=args.ticks_per_delivery,
             delivery_zone=args.delivery_zone,
             coverage=args.coverage,
             singlelayer_speed=args.singlelayer_speed,
             multilayer_speed=args.multilayer_speed,
             flat_speed=args.flat_speed,
             drop_zone=args.drop_zone)
####################################
# Cellular Automata Map Generator  #
# run_random.py                    #
####################################

# Run the generator with sensible random values and dump the map to the console.

import cellular
import postprocess
import random

# Config Section
g = cellular.run(100, 50, random.randint(43, 47), 4, random.randint(15000, 35000), True)
pp_passes = random.randint(0, 5)
neighbor_threshold = random.randint(1, 3)
inverse_operation = False  # Perform inverse cell culling postprocessor operation.
enclose = True  # Run the grid enclosing postprocessor.
fill_not_largest = False  # Fill cells in all areas but the largest.

# Code Section
i = 0
while i < pp_passes:
    postprocess.cull(g, neighbor_threshold, not inverse_operation)
    i += 1

if fill_not_largest:
    postprocess.largest_group(g, True, True)

if enclose:
    postprocess.enclose(g)
Exemple #3
0
######################################
## Cellular Automata Map Generator  ##
## run.py                           ##
######################################

# Run the generator and dump the map to the console.

import cellular, postprocess

#####   CONFIG SECTION   #####
G = cellular.run(100, 50, 45, 4, 20000, True) # Generator values, see "cellular.py".
pp_passes = 5 # Number of cell culling postprocessor passes.
neighbor_threshold = 3 # Neighbor threshold for cell culling postprocessor.
inverse_operation = False # Perform inverse cell culling postprocessor operation.
enclose = True # Run the grid enclosing postprocessor.
fill_not_largest = False # Fill cells in all areas but the largest.
##### END CONFIG SECTION #####

i = 0
while i < pp_passes:
	postprocess.cull(G, neighbor_threshold, not inverse_operation)
	i += 1

if fill_not_largest:
	postprocess.largest_group(G, True, True)

if enclose:
	postprocess.enclose(G)

G.dump({True: " ", False: "#"})