junglejourney

view tools/maps/series.py @ 231:e24e7d33b5e7

Added license headers. Scaled each room image horizontally to create more authentic graphics.
author David Boddie <david@boddie.org.uk>
date Sun Feb 05 02:09:50 2012 +0100
parents f7b16fb00dda
children
line source
1 """
2 Copyright (C) 2011 David Boddie <david@boddie.org.uk>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 """
18 def values(first, second, number):
20 # Add the two values as in the Fibonacci sequence, but take the modulus of
21 # 256 of the result to avoid overflowing into values that require two bytes
22 # or more.
24 while number > 0:
26 new_value = (first + second) & 0xff
28 yield new_value
30 first = second
31 second = new_value
33 number -= 1
35 def unlimited_values(first, second):
37 # Add the two values as in the Fibonacci sequence, but take the modulus of
38 # 256 of the result to avoid overflowing into values that require two bytes
39 # or more.
41 while True:
43 new_value = (first + second) & 0xff
45 yield new_value
47 first = second
48 second = new_value