Login or Sign Up to become a member!
LessThanDot Site Logo

LessThanDot

A Technical Community for IT Professionals

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Highly Rated Users

Forum
No Posts Rated

Top 50
Given
Received

Forum Statistics

Users
Members:
1536
Members Online:
3
Guests Online:
5

Total Post History
Posts:
80270
Topics:
18351

7-Day Post History
New Posts:
7
New Topics:
1
Active Topics:
4

Our newest member
LiDmX

Other

FAQ
All times are UTC [ DST ]

Google Ads

LTD Puzzle 13: Calculate the moon phase

Mind Boggling Puzzles, to keep that grey matter in shape...
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
Please wait...

LTD Puzzle 13: Calculate the moon phase

Postby chrissie1 on Fri Aug 29, 2008 12:42 pm

Calculate the phase of the moon as accurately as possible.

We all know that a moon month is not as long as a normal month. It is about 29.53 days long, but that is an average and not very accurate. SO you will have to find a better implementation than this one: http://www.voidware.com/moon_phase.htm

And for those having fun, once you have that, the calculation of Easter is easy. ;-)

This can take some research. ;-)

So you enter a date and get a % visibility, the calculation (the number that specifies the moon month / phase time corresponding to the "normal" time) and your calculation transformed to a time in days/hours and minutes.

Here is the test data and some results.

Dates are (dd/mm/yyyy)

DateVisibilityMoon Phase NumberMoon Phase Time
29/08/2008 13:56:009 %28.27528d 6h 36m
30/08/2008 13:56:002 %29.27629d 6u 37m
31/08/2008 13:56:005 %0.7450d 17h 53m
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 13: Calculate the moon phase

Postby chrissie1 on Mon Sep 01, 2008 12:39 pm

So here is my implementation in VB.Net

Class: Moonday
Code is hidden, SHOW


Class Quarter
Code is hidden, SHOW


Class Quarters
Code is hidden, SHOW


Class Moonmonth
Code is hidden, SHOW


Main
Code is hidden, SHOW


You'll have to run it to see the result. But let's just say they are very close ;-)
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 13: Calculate the moon phase

Postby rizzo on Fri Jan 30, 2009 12:27 am

-takes a bow-
This should be accurate to within a second or so. (i hope :D)

Code is hidden, SHOW


And the result...

Code is hidden, SHOW
User avatar
rizzo
Apprentice
Apprentice
LTD Bronze - Rating: 51LTD Bronze - Rating: 51
 
Posts: 23
Joined: Wed Jan 21, 2009 11:10 pm
Location: Devon. UK