Permalink
Browse files

Moved easter method higher than thread that requires it

  • Loading branch information...
1 parent 7c88070 commit 417a81998a73fdebad3e79d66e0af24336cb8617 @ndbroadbent committed Apr 4, 2011
Showing with 8 additions and 10 deletions.
  1. +8 −10 octopus_sinatra.rb
View
@@ -41,6 +41,14 @@ def relative(filename)
$lcdTimeThread = nil
+# Every good program should calculate the date of Easter at least once.
+def easter(year)
+ c=year/100;n=year-19*(year/19);k=(c-17)/25;i=c-c/4-(c-k)/3+19*n+15;i-=30*(i/30);
+ i-=(i/28)*(1 -(i/28)*(29/(i+1))*((21-n)/11));j=year+year/4+i+2-c+c/4;j-=7*(j/7);
+ l=i-j;month=3+(l+40)/44;day=l+28-31*(month/4);
+ [day, month]
+end
+
# A custom default message, based on the current date
def motd
time = hk_time
@@ -85,16 +93,6 @@ def lcd_default # Default lcd display
}
end
-# Every good program should calculate the date of Easter at least once.
-def easter(year)
- c=year/100;n=year-19*(year/19);k=(c-17)/25;i=c-c/4-(c-k)/3+19*n+15;i-=30*(i/30);
- i-=(i/28)*(1 -(i/28)*(29/(i+1))*((21-n)/11));j=year+year/4+i+2-c+c/4;j-=7*(j/7);
- l=i-j;month=3+(l+40)/44;day=l+28-31*(month/4);
- [day, month]
-end
-
-
-
def unlock_door_action
Thread.new do
$k8055.set_digital SwitchChannel, false

0 comments on commit 417a819

Please sign in to comment.