public
Fork of evanfarrar/opensprints
Description: Bringing GoldSprints to the masses.
Homepage: http://www.opensprints.com/
Clone URL: git://github.com/toothrot/opensprints.git
Fixed some broken edge cases in the race logic.
evanfarrar (author)
Fri Jul 25 23:09:41 -0700 2008
commit  99efe0db8dc8af14e3aa37693709fed0aea75e69
tree    b838dd7224667d2fec8691b573c793e81897fdd5
parent  16a9f085416b7858c873b9610e658f567ddddc0f
...
33
34
35
36
 
37
38
39
...
33
34
35
 
36
37
38
39
0
@@ -33,7 +33,7 @@ unsigned long racer1FinishTimeMillis;
0
 unsigned long lastCountDownMillis;
0
 int lastCountDown;
0
 
0
-int raceLengthTicks = 200;
0
+int raceLengthTicks = 700;
0
 int previousFakeTickMillis = 0;
0
 
0
 int updateInterval = 250;
...
94
95
96
97
 
98
99
100
...
109
110
111
112
 
113
114
...
94
95
96
 
97
98
99
100
...
109
110
111
 
112
113
114
0
@@ -94,7 +94,7 @@ class RacePresenter
0
         @shoes_instance.span(@blue.name,{:stroke => "#00F"}),
0
         {:top => 300, :align => 'center'})
0
 
0
- if @sensor.values[:red_finish] || @sensor.values[:blue_finish]#@race.complete?
0
+ if @sensor.values[:red_finish] && @sensor.values[:blue_finish]#@race.complete?
0
        # @shoes_instance.title "#{@race.winner.name.upcase} WINS!!!\n", :align => "center",
0
         # :top => 380, :width => 800, :stroke => @shoes_instance.ivory
0
         @shoes_instance.title "#{@red.name}: #{@sensor.values[:red_finish]/1000.0}s, #{@blue.name}: #{@sensor.values[:blue_finish]/1000.0}s", :stroke => @shoes_instance.ivory,
0
@@ -109,6 +109,6 @@ class RacePresenter
0
   end
0
 
0
   def percent_complete(racer)
0
- [1.0, racer.ticks/@race_distance.to_f].min
0
+ [1.0, (racer.ticks||0)/@race_distance.to_f].min
0
   end
0
 end

Comments

    No one has commented yet.