Format:
Recent snippets matching tags of Python life game board
import random lifechance = .1 ## 10 % chance for life in square board = [] for x in range (50): # '*' == life, '' == dead board.append(['*' if random.random()<lifechance else '' for notcare in range(50)]) # make strings for lines replacing '' values (which are considered False) with ' ' print '\n'.join(''.join(life if life else ' ' for life in row)
149 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
