From 1cbfb79509b1fd27c07f14bbc91b04c64166c7ce Mon Sep 17 00:00:00 2001 From: Todd Wolfson Date: Fri, 24 May 2013 09:17:43 -0700 Subject: [PATCH 1/3] Added multi-line ASCII to sprite support --- gitfiti.py | 39 ++++++++++++++++++++++++++++++++++++++- tmp.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 tmp.py diff --git a/gitfiti.py b/gitfiti.py index 8ea7c841f..22b703e96 100755 --- a/gitfiti.py +++ b/gitfiti.py @@ -76,6 +76,42 @@ hireme=[ [2,0,2,0,2,0,2,0,0,0,2,0,0,0,0,2,0,2,0,2,0,2,0,0], [1,0,1,0,1,0,1,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1,1,1]] +ascii_to_number = { + '_': 0, + '_': 1, + '.': 2, + ':': 3, + '-': 4 +} + +def str_to_sprite(content): + # Break out lines and filter any excess + lines = content.split('\n') + def is_empty_line(line): + return len(line) != 0 + lines = filter(is_empty_line, lines) + + # Break up lines into each character + split_lines = map(list, lines) + + # Replace each character with its numeric equivalent + for line in split_lines: + for index, char in enumerate(line): + line[index] = ascii_to_number.get(char, 0) + + # Return the formatted str + return split_lines + +oneup_str = str_to_sprite(""" + ------- +-:.._..:- +-..___..- +-:-----:- +--_-_-_-- + -_____- + ----- +""") + images={ 'kitty':kitty, 'oneup':oneup, @@ -84,7 +120,8 @@ images={ 'octocat':octocat, 'octocat2':octocat2, 'hello':hello, -'hireme':hireme +'hireme':hireme, +'oneup_str':oneup_str } def load_images(imgNames): diff --git a/tmp.py b/tmp.py new file mode 100644 index 000000000..11975357d --- /dev/null +++ b/tmp.py @@ -0,0 +1,37 @@ +ascii_to_number = { + '_': 0, + '_': 1, + '.': 2, + ':': 3, + '-': 4 +} + +def str_to_sprite(content): + # Break out lines and filter any excess + lines = content.split('\n') + def is_empty_line(line): + return len(line) != 0 + lines = filter(is_empty_line, lines) + + # Break up lines into each character + split_lines = map(list, lines) + + # Replace each character with its numeric equivalent + for line in split_lines: + for index, char in enumerate(line): + line[index] = ascii_to_number.get(char, 0) + + # Return the formatted str + return split_lines + +oneup_str = str_to_sprite(""" + ------- +-:.._..:- +-..___..- +-:-----:- +--_-_-_-- + -_____- + ----- +""") + +print oneup_str \ No newline at end of file From ff3b786c5b9195a002e6a44b3b96f652fa9a0a26 Mon Sep 17 00:00:00 2001 From: Todd Wolfson Date: Fri, 24 May 2013 09:21:54 -0700 Subject: [PATCH 2/3] Removed temporary file --- tmp.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 tmp.py diff --git a/tmp.py b/tmp.py deleted file mode 100644 index 11975357d..000000000 --- a/tmp.py +++ /dev/null @@ -1,37 +0,0 @@ -ascii_to_number = { - '_': 0, - '_': 1, - '.': 2, - ':': 3, - '-': 4 -} - -def str_to_sprite(content): - # Break out lines and filter any excess - lines = content.split('\n') - def is_empty_line(line): - return len(line) != 0 - lines = filter(is_empty_line, lines) - - # Break up lines into each character - split_lines = map(list, lines) - - # Replace each character with its numeric equivalent - for line in split_lines: - for index, char in enumerate(line): - line[index] = ascii_to_number.get(char, 0) - - # Return the formatted str - return split_lines - -oneup_str = str_to_sprite(""" - ------- --:.._..:- --..___..- --:-----:- ---_-_-_-- - -_____- - ----- -""") - -print oneup_str \ No newline at end of file From 360c10e28dd77d5484f3220163baccbd0161218b Mon Sep 17 00:00:00 2001 From: Todd Wolfson Date: Sat, 25 May 2013 20:52:59 -0700 Subject: [PATCH 3/3] Moved to better character set of string based sprites --- gitfiti.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gitfiti.py b/gitfiti.py index 22b703e96..ab5708e78 100755 --- a/gitfiti.py +++ b/gitfiti.py @@ -79,9 +79,9 @@ hireme=[ ascii_to_number = { '_': 0, '_': 1, - '.': 2, - ':': 3, - '-': 4 + '~': 2, + '=': 3, + '*': 4 } def str_to_sprite(content): @@ -103,13 +103,13 @@ def str_to_sprite(content): return split_lines oneup_str = str_to_sprite(""" - ------- --:.._..:- --..___..- --:-----:- ---_-_-_-- - -_____- - ----- + ******* +*=~~-~~=* +*~~---~~* +*=*****=* +**-*-*-** + *-----* + ***** """) images={