
// <![CDATA[
// Handle guesses from the child frames
var current_game = 0;
var all_games = ['carbondale', 'aspen', 'copper-mountain', 'grand-lake', 'estes-park', 'fort-collins'];
window.addEventListener('message', function(event) {
if ( event.origin === 'http://extras.denverpost.com' || event.origin === 'http://localhost' )
{
if ( typeof event.data.distance !== 'undefined' )
{
map_group.add_guess(event.data.distance);
current_game += 1;
var slug = all_games[current_game];
var title = slug.replace(/-/g, ' ');
// Count down to the next game
var countdown = 8;
$('#countdown').removeClass('hide');
$('#countdown').addClass('show');
var interval = window.setInterval(function() { $('#countdown_timer').text(countdown); countdown –; if ( countdown == 0 ) window.clearInterval(interval); }, 1000)
// Load the next game
window.setTimeout(function () { $('#game').html('’ + title + ‘'+'h2>Next game loads in: 9'+'p>‘); }, ‘9000’);
// Update the status texts
$(‘#guessed’).html(current_game);
if ( event.data.distance == 0 ) $(‘#correct’).html(map_group.correct);
}
}
}, false);
var map_group = {
config: {
games: 6,
log_url: ‘http://denverpostplus.com/app/mapgame/tally.php’,
slug: ‘rtr-2016’
},
guesses: 0,
distance: 0,
correct: 0,
add_guess: function (distance)
{
this.guesses += 1;
this.distance += distance;
if ( distance === 0 )
{
this.correct += 1;
}
if ( this.guesses === this.config.games )
{
// They finished the game. Log the results and scroll to them.
var distance = Math.floor(this.distance/this.guesses);
$(‘#result’).append(‘Your 6 guesses landed, on average, ‘ + distance + ‘ miles away from the targets. You got ‘ + this.correct + ‘ correct.’);
var params = ‘?slug=’ + this.config.slug + ‘&distance=’ + distance + ‘&correct=’ + this.correct + ‘&lat=0&lon=0&callback=’;
var jqxhr = $.getJSON( this.config.log_url + params, function(data)
{
// Success
// Display how the reader has done compared to everyone else.
$(‘#result’).append(‘On average, people got ‘ + data.average_correct + ‘ correct. ‘);
var average = Math.round(data.average);
$(‘#result’).append(‘ ‘ + data.guesses + ‘ other people have played. An average guess, across all guesses, landed ‘ + average + ‘ miles away.’);
})
.fail(function() {
// Error
$(‘#result’).append(‘ Sorry, we could not reach the upstream servers. Please refresh the page and try again.’);
})
.always(function() {
// Complete
});
$(‘html, body’).animate({
scrollTop: $(“#result”).offset().top
}, 2000);
}
}
};
// ]]>
Drag the marker to where you think each city on (which kicks off in Carbondale on Saturday) is.
When you drop it, the answer will appear, and you’ll see how your guess compares with everyone else who has played.
Progress: 0 / 6 finished, 0 correct.
Carbondale
Next game loads in:
Ride The Rockies history
.
Previous map games
Group Games
- Play the
- Play the
- Play the
- Play the
Colorado Map Games
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
North American Map Games
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
World Map Games
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
<!–
–>
[mapgame id=”footer”]