
// Handle guesses from the child frames
var current_game = 0;
var all_games = [‘alberta’, ‘british-columbia’, ‘manitoba’, ‘new-brunswick’, ‘newfoundland-labrador’, ‘northwest-territories’, ‘nova-scotia’, ‘ontario’, ‘prince-edward-island’, ‘quebec’, ‘saskatchewan’, ‘yukon’, ‘nunavut’];
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;
if ( current_game < all_games.length )
{
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 + ‘Next game loads in: 9' + 'p>\n\
‘); }, ‘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: 13,
log_url: ‘http://denverpostplus.com/app/mapgame/tally.php’,
slug: ‘canadian-provinces’
},
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 13 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);
}
}
};
Can you place all the Canadian provinces and territories?
Drag the marker to where you think each province / territory is.
When you drop it, the answer will appear, and you’ll see how your guess compares with everyone else who has played.
After you make one guess, the next map will appear.
After you finish all the games, you’ll see how your final score compares against everyone else who finished.
Progress: 0 / 13 finished, 0 correct.
Alberta
Next game loads in:
Alberta
British Columbia
Manitoba
New Brunswick
Newfoundland and Labrador
Northwest Territories
Nova Scotia
Ontario
Prince Edward Island
Quebec
Saskatchewan
Yukon
Nunavut
body { margin:2%; }
@media only screen and (max-width:650px) {
}
.gameframe
{
border: 0;
width: 100%;
height: 700px;
overflow: hidden;
}
.hide { display: none; }
.show { display: block; }
#countdown { color: blue; }
#result { font-size: 150%; color: red; font-weight: bold; }
.titlecase { text-transform: capitalize; }
h3 { color: #666; }
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
- Play the Where is ? map game
<!–
–>



