In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Project Euler 19

@see http://projecteuler.net/index.php?section=problems&id=19
Get Adobe Flash player
by nitoyon 07 Mar 2010
/**
 * Copyright nitoyon ( http://wonderfl.net/user/nitoyon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/blR0
 */

package{
import flash.display.Sprite;
import flash.text.*;

// @see http://projecteuler.net/index.php?section=problems&id=19
public class Eular extends Sprite{
    private const days:Array = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

    public function Eular() {
        var ans:uint = 0;

        var d:int = 1;
        for (var i:int = 1900; i <= 2000; i++){
            for (var j:int = 0; j < 12; j++){
                if (i > 1900 && d == 0) ans++;
                d += days[j];
                if (i % 4 == 0 && (i % 100 != 0 || i % 400 == 0) && j == 1) d++;
                d %= 7;
            }
        }

        var t:TextField = TextField(addChild(new TextField()));
        t.text = ans.toString();
    }
}
}