<s> __author__ = """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from os import getcwd <EOL> from os import sys <EOL> sys . path . append ( getcwd ( ) ) <EOL> from MOAL . helpers . display import Section <EOL> from MOAL . helpers . display import print_simple <EOL> from random import randrange as rr <EOL> DEBUG = True if __name__ == '<STR_LIT:__main__>' else False <EOL> class Lightmap : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , height = <NUM_LIT:10> , width = <NUM_LIT:10> ) : <EOL> self . height = height <EOL> self . width = width <EOL> self . lighting = [ ] <EOL> def __str__ ( self ) : <EOL> """<STR_LIT>""" <EOL> fake_display = '<STR_LIT>' <EOL> for k , pixel in enumerate ( self . lighting ) : <EOL> if pixel > <NUM_LIT:200> : <EOL> fake_display += '<STR_LIT:#>' <EOL> elif pixel > <NUM_LIT:100> : <EOL> fake_display += '<STR_LIT:@>' <EOL> elif pixel > <NUM_LIT:50> : <EOL> fake_display += '<STR_LIT:+>' <EOL> else : <EOL> fake_display += '<STR_LIT:.>' <EOL> if k % self . width == <NUM_LIT:0> : <EOL> fake_display += '<STR_LIT:\n>' <EOL> print ( fake_display ) <EOL> return '<STR_LIT>' <EOL> def compute ( self , recipe = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> self . lighting = [ ] <EOL> pixels = self . height * self . width <EOL> if recipe == <NUM_LIT:1> : <EOL> for k in xrange ( pixels ) : <EOL> self . lighting . append ( rr ( <NUM_LIT:0> , <NUM_LIT:255> ) ) <EOL> elif recipe == <NUM_LIT:2> : <EOL> for k in xrange ( pixels ) : <EOL> self . lighting . append ( rr ( <NUM_LIT:0> , ( k + <NUM_LIT:1> ) * <NUM_LIT:5> ) ) <EOL> elif recipe == <NUM_LIT:3> : <EOL> for k in xrange ( pixels ) : <EOL> if self . width < self . height : <EOL> self . lighting . append ( rr ( self . width , self . height ) ) <EOL> else : <EOL> self . lighting . append ( rr ( self . height , self . width ) ) <EOL> if DEBUG : <EOL> with Section ( '<STR_LIT>' ) : <EOL> lightmap = Lightmap ( height = <NUM_LIT:10> , width = <NUM_LIT> ) <EOL> lightmap . compute ( ) <EOL> print_simple ( lightmap , '<STR_LIT>' ) <EOL> lightmap . compute ( recipe = <NUM_LIT:2> ) <EOL> print_simple ( lightmap , '<STR_LIT>' ) <EOL> lightmap . compute ( recipe = <NUM_LIT:3> ) <EOL> print_simple ( lightmap , '<STR_LIT>' ) </s>
