mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-12 15:50:20 -08:00
MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be many adjustments necessary
This commit is contained in:
@@ -2,21 +2,241 @@
|
||||
|
||||
|
||||
# This data is meant to be read-only, so we are storing it in a tuple
|
||||
DATA = (2,21,14,14,25,
|
||||
1,2,-1,0,2,45,50,-1,0,5,43,52,-1,0,7,41,52,-1,
|
||||
1,9,37,50,-1,2,11,36,50,-1,3,13,34,49,-1,4,14,32,48,-1,
|
||||
5,15,31,47,-1,6,16,30,45,-1,7,17,29,44,-1,8,19,28,43,-1,
|
||||
9,20,27,41,-1,10,21,26,40,-1,11,22,25,38,-1,12,22,24,36,-1,
|
||||
13,34,-1,14,33,-1,15,31,-1,17,29,-1,18,27,-1,
|
||||
19,26,-1,16,28,-1,13,30,-1,11,31,-1,10,32,-1,
|
||||
8,33,-1,7,34,-1,6,13,16,34,-1,5,12,16,35,-1,
|
||||
4,12,16,35,-1,3,12,15,35,-1,2,35,-1,1,35,-1,
|
||||
2,34,-1,3,34,-1,4,33,-1,6,33,-1,10,32,34,34,-1,
|
||||
14,17,19,25,28,31,35,35,-1,15,19,23,30,36,36,-1,
|
||||
14,18,21,21,24,30,37,37,-1,13,18,23,29,33,38,-1,
|
||||
12,29,31,33,-1,11,13,17,17,19,19,22,22,24,31,-1,
|
||||
10,11,17,18,22,22,24,24,29,29,-1,
|
||||
22,23,26,29,-1,27,29,-1,28,29,-1,4096)
|
||||
DATA = (
|
||||
2,
|
||||
21,
|
||||
14,
|
||||
14,
|
||||
25,
|
||||
1,
|
||||
2,
|
||||
-1,
|
||||
0,
|
||||
2,
|
||||
45,
|
||||
50,
|
||||
-1,
|
||||
0,
|
||||
5,
|
||||
43,
|
||||
52,
|
||||
-1,
|
||||
0,
|
||||
7,
|
||||
41,
|
||||
52,
|
||||
-1,
|
||||
1,
|
||||
9,
|
||||
37,
|
||||
50,
|
||||
-1,
|
||||
2,
|
||||
11,
|
||||
36,
|
||||
50,
|
||||
-1,
|
||||
3,
|
||||
13,
|
||||
34,
|
||||
49,
|
||||
-1,
|
||||
4,
|
||||
14,
|
||||
32,
|
||||
48,
|
||||
-1,
|
||||
5,
|
||||
15,
|
||||
31,
|
||||
47,
|
||||
-1,
|
||||
6,
|
||||
16,
|
||||
30,
|
||||
45,
|
||||
-1,
|
||||
7,
|
||||
17,
|
||||
29,
|
||||
44,
|
||||
-1,
|
||||
8,
|
||||
19,
|
||||
28,
|
||||
43,
|
||||
-1,
|
||||
9,
|
||||
20,
|
||||
27,
|
||||
41,
|
||||
-1,
|
||||
10,
|
||||
21,
|
||||
26,
|
||||
40,
|
||||
-1,
|
||||
11,
|
||||
22,
|
||||
25,
|
||||
38,
|
||||
-1,
|
||||
12,
|
||||
22,
|
||||
24,
|
||||
36,
|
||||
-1,
|
||||
13,
|
||||
34,
|
||||
-1,
|
||||
14,
|
||||
33,
|
||||
-1,
|
||||
15,
|
||||
31,
|
||||
-1,
|
||||
17,
|
||||
29,
|
||||
-1,
|
||||
18,
|
||||
27,
|
||||
-1,
|
||||
19,
|
||||
26,
|
||||
-1,
|
||||
16,
|
||||
28,
|
||||
-1,
|
||||
13,
|
||||
30,
|
||||
-1,
|
||||
11,
|
||||
31,
|
||||
-1,
|
||||
10,
|
||||
32,
|
||||
-1,
|
||||
8,
|
||||
33,
|
||||
-1,
|
||||
7,
|
||||
34,
|
||||
-1,
|
||||
6,
|
||||
13,
|
||||
16,
|
||||
34,
|
||||
-1,
|
||||
5,
|
||||
12,
|
||||
16,
|
||||
35,
|
||||
-1,
|
||||
4,
|
||||
12,
|
||||
16,
|
||||
35,
|
||||
-1,
|
||||
3,
|
||||
12,
|
||||
15,
|
||||
35,
|
||||
-1,
|
||||
2,
|
||||
35,
|
||||
-1,
|
||||
1,
|
||||
35,
|
||||
-1,
|
||||
2,
|
||||
34,
|
||||
-1,
|
||||
3,
|
||||
34,
|
||||
-1,
|
||||
4,
|
||||
33,
|
||||
-1,
|
||||
6,
|
||||
33,
|
||||
-1,
|
||||
10,
|
||||
32,
|
||||
34,
|
||||
34,
|
||||
-1,
|
||||
14,
|
||||
17,
|
||||
19,
|
||||
25,
|
||||
28,
|
||||
31,
|
||||
35,
|
||||
35,
|
||||
-1,
|
||||
15,
|
||||
19,
|
||||
23,
|
||||
30,
|
||||
36,
|
||||
36,
|
||||
-1,
|
||||
14,
|
||||
18,
|
||||
21,
|
||||
21,
|
||||
24,
|
||||
30,
|
||||
37,
|
||||
37,
|
||||
-1,
|
||||
13,
|
||||
18,
|
||||
23,
|
||||
29,
|
||||
33,
|
||||
38,
|
||||
-1,
|
||||
12,
|
||||
29,
|
||||
31,
|
||||
33,
|
||||
-1,
|
||||
11,
|
||||
13,
|
||||
17,
|
||||
17,
|
||||
19,
|
||||
19,
|
||||
22,
|
||||
22,
|
||||
24,
|
||||
31,
|
||||
-1,
|
||||
10,
|
||||
11,
|
||||
17,
|
||||
18,
|
||||
22,
|
||||
22,
|
||||
24,
|
||||
24,
|
||||
29,
|
||||
29,
|
||||
-1,
|
||||
22,
|
||||
23,
|
||||
26,
|
||||
29,
|
||||
-1,
|
||||
27,
|
||||
29,
|
||||
-1,
|
||||
28,
|
||||
29,
|
||||
-1,
|
||||
4096,
|
||||
)
|
||||
|
||||
|
||||
def display_intro():
|
||||
@@ -26,9 +246,9 @@ def display_intro():
|
||||
|
||||
|
||||
def tab(column):
|
||||
""" Emulates the TAB command in BASIC. Returns a string with ASCII
|
||||
codes for setting the cursor to the specified column. """
|
||||
return "\r\33[{}C".format(column)
|
||||
"""Emulates the TAB command in BASIC. Returns a string with ASCII
|
||||
codes for setting the cursor to the specified column."""
|
||||
return f"\r\33[{column}C"
|
||||
|
||||
|
||||
def play():
|
||||
@@ -71,7 +291,7 @@ def play():
|
||||
# The following number, indicates the end of the segment.
|
||||
end = next(data)
|
||||
# Unlike FOR I=X TO Y, the 'stop' argument of 'range' is non-inclusive, so we must add 1
|
||||
for i in range(start, end+1, 1):
|
||||
for i in range(start, end + 1, 1):
|
||||
# Cycle through the letters in "BUNNY" as we draw line
|
||||
j = i - 5 * int(i / 5)
|
||||
print(chr(L + bunny[j]), end="")
|
||||
|
||||
Reference in New Issue
Block a user