1+ # The MIT License (MIT)
2+ #
3+ # Copyright (c) 2018 Dave Astels
4+ #
5+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6+ # of this software and associated documentation files (the "Software"), to deal
7+ # in the Software without restriction, including without limitation the rights
8+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+ # copies of the Software, and to permit persons to whom the Software is
10+ # furnished to do so, subject to the following conditions:
11+ #
12+ # The above copyright notice and this permission notice shall be included in
13+ # all copies or substantial portions of the Software.
14+ #
15+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+ # THE SOFTWARE.
22+
23+ """
24+ A gaunlet running game using the dotstar wing and the joy wing.
25+ """
26+
27+ import time
28+ import random
29+
130import board
231import busio
332import dotstar_featherwing
433import Adafruit_seesaw
5- import time
6- import random
734
835i2c = busio .I2C (board .SCL , board .SDA )
936ss = Adafruit_seesaw .Seesaw (i2c )
2249
2350
2451def run ():
52+ """Play the game."""
53+
2554 player_position_col = 6
2655 score = 0
2756 steps = 0
@@ -48,7 +77,7 @@ def run():
4877 else :
4978 player_delta = 0
5079 player_position_col += player_delta
51-
80+
5281 under_player = wing .get_color (3 , player_position_col )
5382 if under_player == background :
5483 return steps , score
@@ -65,7 +94,7 @@ def run():
6594while True :
6695 result = run ()
6796 # got here because of a crash, so report and restart
68- print ( 'Score: {} Steps: {}' .format (result [1 ], result [0 ]) )
97+ print 'Score: {} Steps: {}' .format (result [1 ], result [0 ])
6998 wing .clear ()
7099 wing .show ()
71100 wing .fill ((255 , 0 , 0 ))
0 commit comments