Paste: icfp2009 score
Author: | rand |
Mode: | factor |
Date: | Sat, 27 Jun 2009 12:56:58 |
Plain Text |
USING: namespaces kernel icfp2009.vm ;
IN: icfp2009
SYMBOLS: our-ship ;
TUPLE: satellite
velocity
acceleration
location
initial-fuel
remaining-fuel
{ timesteps initial: 0 }
hook-timesteps ;
: <satellite> ( -- tuple )
satellite new ;
<satellite> our-ship set
: scenario1 ( -- seq ) "vocab:icfp2009/bin1.obf" data-file>vm ;
: scenario2 ( -- seq ) "vocab:icfp2009/bin2.obf" data-file>vm ;
: scenario3 ( -- seq ) "vocab:icfp2009/bin3.obf" data-file>vm ;
: scenario4 ( -- seq ) "vocab:icfp2009/bin4.obf" data-file>vm ;
: magnetize-to-satellite ( satellite -- )
unimplemented ;
USING: kernel math namespaces icfp2009 ;
IN: icfp2009.score
SYMBOL: task-end-time
: scenario-score ( -- score )
our-ship get [ remaining-fuel>> ] [ initial-fuel>> ] bi / 45 * 25 +
task-end-time get 1000 / log2 30 swap -
+ ;
: hohmann-score ( -- n )
scenario-score ;
: meet-and-greet-score ( -- n )
scenario-score 2 * ;
: eccentric-score ( -- n )
scenario-score 4 * ;
: clear-sky-total-time ( -- time )
all-satellites [ hook-timesteps>> 10 6 ^ 2 * swap - ] map sum ;
: clear-sky-time-score ( -- score )
clear-sky-total-time 24 10 6 ^ * / 75 * ;
: clear-sky-fuel-score ( -- score )
our-ship get
fueling-station get 2array
[ [ remaining-fuel>> ] [ initial-fuel>> ] bi / ] map sum
25 * ;
: clear-sky-score ( -- n )
clear-sky-time-score clear-sky-fuel-score 8 * ;
: total-score ( -- n )
[ hohmann-score
meet-and-greet-score
eccentric-score
clear-sky-score ] output>array sum ;
Author: | r |
Mode: | factor |
Date: | Sat, 27 Jun 2009 16:35:50 |
Plain Text |
: clear-sky-score ( -- n )
clear-sky-time-score clear-sky-fuel-score + 8 * ;
New Annotation