This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- I was recently asked what license this code is under. Since it is fairly trivial code, | |
| I don't really feel it "deserves" a "real" license, so I am hereby placing it in the public domain. | |
| In countries where this is not posible, I am placing it under Creative Commons CC0 | |
| (https://creativecommons.org/publicdomain/zero/1.0/), which is basically just a more formal way of | |
| putting it in the public domain for people who like to be sure. | |
| If you want to credit me anyway, that is of course fine with me :) --> | |
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <div id="renderDiv" style='font-family:"Lucida Console", Monaco, monospace' /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import shuffle, randint | |
| from PIL import Image | |
| def generate_maze(X, Y): | |
| ''' | |
| Generate a maze and return its walls | |
| Return type (x_walls, y_walls) | |
| x_walls/y_walls - bool array, True = wall, False = no wall | |
| x_walls/y_walls ordered from left to right / top to bottom | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def listprimes2(m): | |
| '''another attempt to list all primes below m''' | |
| values = range(m+1) #note that in this list the key and the value are the same. | |
| primes = list(values)[:] | |
| primes[1] = 0 #1 doesn't count as a prime | |
| for i in values: | |
| if primes[i] == 0: | |
| pass | |
| else: | |
| for j in values[i+1:]: |