Demo entry 3375995

procedural terrain generator

   

Submitted by anonymous on Dec 19, 2015 at 20:47
Language: Python. Code size: 531 Bytes.

import random

last = 0
skipped = 0
sym=[" ","X"]
a=""
b=""
for i in range(100):
    if skipped:
        #print("|{0}{1}|".format(sym[last],sym[not(last)]))
        a+=sym[last]
        b+=sym[not(last)]
        skipped = 0
    elif random.randint(0,10)%2 != last:
        last = not(last)
        skipped = 1
        #print("|  |")
        a+=" "
        b+=" "
    else:
        #print("|{0}{1}|".format(sym[last],sym[not(last)]))
        a+=sym[last]
        b+=sym[not(last)]
        
print(a)
print(b)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).