Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: doxypypy/doxypypy/test/sample_maze.outnn.py

Issue 1574883002: add doxypypy and py_filter so this will turn google style (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 ## @brief Generate a simple maze pattern.
4 #
5 #Tip of the hat to both the original Commodore 64 program and the book
6 #"10 Print Chr$(205.5+rnd(1)); Goto 10" that it inspired.
7 #
8 #Note that this is neither the shortest nor the most faithful way to
9 #write this program in Python. Rather it is being used as a simple
10 #example for the doxypypy Doxygen input filter for Python and makes use
11 #of features like keyword arguments and generators and has a docstring
12 #that documents them both appropriately.
13 #
14
15
16 from sys import stdout
17 from random import choice
18
19
20 ## @brief Generates a single block of a maze.
21 #
22 # This simple generator randomly picks a character from a list (the two
23 # diagonal lines by default) and returns it on each iteration.
24 #
25 #
26 # @param blockOptions The list of characters to choose from.
27 #
28 # @return
29 # A single character chosen from blockOptions.
30 #
31
32 def generateBlock(blockOptions=u"╱╲"):
33 while True:
34 yield choice(blockOptions)
35
36 # Establish our block generator and generate a series of blocks.
37 blockGenerator = generateBlock()
38 blockCount = 0
39 while blockCount < 3200:
40 blockCount += 1
41 print(next(blockGenerator)),
42 # Deal with Python's extra space print weirdness.
43 stdout.softspace = False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698