@@ -38,10 +38,10 @@ def __init__(self, disp, x, y, type='l'):
3838 self .score = 0
3939 self .xoffset = 0.3
4040 self .yoffset = 0.1
41- if type == 'r' :
41+ if type == 'r' :
4242 self .xoffset *= - 1.0
4343
44- if type == 'l' or type == 'r' :
44+ if type == 'l' or type == 'r' :
4545 self .signx = - 1.0
4646 self .signy = 1.0
4747 else :
@@ -54,7 +54,7 @@ def contains(self, loc):
5454
5555class Puck (object ):
5656 def __init__ (self , disp , pad , field ):
57- self .vmax = .2
57+ self .vmax = .2
5858 self .disp = disp
5959 self .field = field
6060 self ._reset (pad )
@@ -76,8 +76,8 @@ def update(self, pads):
7676 self .y += self .vy
7777 for pad in pads :
7878 if pad .contains (self ):
79- self .vx *= 1.2 * pad .signx
80- self .vy *= 1.2 * pad .signy
79+ self .vx *= 1.2 * pad .signx
80+ self .vy *= 1.2 * pad .signy
8181 fudge = .001
8282 # probably cleaner with something like...if not self.field.contains(self.x, self.y):
8383 if self .x < 0 + fudge :
@@ -121,9 +121,9 @@ class Game(object):
121121 def __init__ (self , ax ):
122122 # create the initial line
123123 self .ax = ax
124- padAx = padBx = .50
125- padAy = padBy = .30
126- padBx += 6.3
124+ padAx = padBx = .50
125+ padAy = padBy = .30
126+ padBx += 6.3
127127 pA , = self .ax .barh (padAy , .2 , height = .3 , color = 'k' , alpha = .5 , edgecolor = 'b' , lw = 2 , label = "Player B" , animated = True )
128128 pB , = self .ax .barh (padBy , .2 , height = .3 , left = padBx , color = 'k' , alpha = .5 , edgecolor = 'r' , lw = 2 , label = "Player A" , animated = True )
129129
@@ -147,7 +147,7 @@ def __init__(self, ax):
147147 self .pads = []
148148 self .pads .append (Pad (pA , 0 , padAy ))
149149 self .pads .append (Pad (pB , padBx , padBy , 'r' ))
150- self .pucks = []
150+ self .pucks = []
151151 self .i = self .ax .annotate (instructions , (.5 , 0.5 ),
152152 name = 'monospace' ,
153153 verticalalignment = 'center' ,
@@ -190,8 +190,8 @@ def draw(self, evt):
190190 for puck in self .pucks :
191191 if puck .update (self .pads ):
192192 # we only get here if someone scored
193- self .pads [0 ].disp .set_label (" " + str (self .pads [0 ].score ))
194- self .pads [1 ].disp .set_label (" " + str (self .pads [1 ].score ))
193+ self .pads [0 ].disp .set_label (" " + str (self .pads [0 ].score ))
194+ self .pads [1 ].disp .set_label (" " + str (self .pads [1 ].score ))
195195 self .ax .legend (loc = 'center' )
196196 self .leg = self .ax .get_legend ()
197197 #self.leg.draw_frame(False) #don't draw the legend border
@@ -207,7 +207,7 @@ def draw(self, evt):
207207 # just redraw the axes rectangle
208208 self .canvas .blit (self .ax .bbox )
209209
210- if self .cnt == 50000 :
210+ if self .cnt == 50000 :
211211 # just so we don't get carried away
212212 print ("...and you've been playing for too long!!!" )
213213 plt .close ()
0 commit comments