Today I had a day off work, and what better way to spend it than by programming an Excel spreadsheet 'port' of the web game 2048? So that is exactly what I did!
This is a beta version of the game: I'm not entirely convinced that I've got every aspect of the gameplay quite right (my random weightings for the spawning of 2s and 4s may be a little out), and there's always the small possibility of the odd formula error somewhere along the line causing tiles to misbehave. Anything like that can be easily ironed out. The point is that it works!
[Edit - I spotted one problem that needed fixing: new tiles shouldn't spawn when all adjacents in a direction are doubled and shunted. Tut. I've added a new line of sums to monitor and block spawning in this situation, and things are working a lot better as a consequence.]
[Edit - I spotted one problem that needed fixing: new tiles shouldn't spawn when all adjacents in a direction are doubled and shunted. Tut. I've added a new line of sums to monitor and block spawning in this situation, and things are working a lot better as a consequence.]
The game was designed in Excel 2007, and requires macros to be enabled. Right click here to download yourself a copy at a tidy 32K. If your browser tries to save the file as a .zip, be sure to correct it and to save it as a.xlsm file.
The gubbins that works the game can be found to the right of the sheet, explored and amended to suit your tastes. Basically, the five buttons (four cursors and a "New Game" reset) copy the current grid to a space below it (or in the case of the reset, copy a blank grid), and then the gubbins does the rest.
Each move follows a three-stage process: shunt the tiles together to skip the blanks; double up adjacent duplicates; shunt again. Calculations are made for all four directions. This was the trickiest bit to work out, and I'm thankful that there are only four rows to work with at a time. There was a fair bit of trial and error beyond the initial idea of what should happen.
The random tile was another tough thing to implement. It is calculated by totting up the number of empty spaces, then allocating each one a number (using =COUNTIF), and picking one of the spaces at random using the =RANDBETWEEN function. I'm quite proud of this, though like I say, I'm not sure I've got the weighting right as I'm clocking in some high scores.
Scoring is achieved by totting up the difference between the shunted grid and the doubled grid, and applying a square/root to knock off any negatives.
Anyway, feel free to have a trawl of the cells and let me know if you find any glaring errors. If you'd like me to make a step-by-step work-through I'll give it a go.

Hi! I don't know about that but I really liked your ESC column - quite possibly the best written out there when it comes to the subject. I don't always agree with choices of yours (although mostly I do) but it is always a pleasure to read.
ReplyDeleteAnyway, I wrote here because you've made a few errors when counting AV votes - you gave Spain's 7 points in 1986 to Denmark so the result is respectively 231 and 120, while it should have been 238 and 113. Plus you mixed 1992 points with 3 going to Ireland, 6 to Israel and 0 to Iceland, while it should have been 3 to ISR, 6 to ISL and nothing to bland Irish entry. Rightful scores: ISR 138, ISL 46 and IRE 71 (not included 1 from 2013 as you didn't add that year yet) while you have 141, 40 and 74 respectively. Might help in the future. I found no other way to communicate with you, therefore I wrote here.
I was amazed how many of your 1998-2011 original rankings were changed later on when you voted again - mostly how many times Spain was allowed in and France out. I adored your site even before 2013 edition and so tried to predict what's gonna be in your Top 10. The only points that, IMO, didn't make any sense based on what you picked in the past, were 3 points to Georgia.
I was a big fan of your National Grid - Top 10 by Top 15 nations, even if going Top 5 for some of them was disappointing. Any chance you would do at least Top 3 of remaining countries or the best semi-final non-qualifiers? It would be a treat to read.
Have a great 2014 night,
TheDRMISTERY
Hi! Thanks for the comment: really glad you like the ESC stuff (and even that you agree with some of our choices!). Thanks also for the corrections: good to know that people are paying attention ;-) I shall correct my spreadsheets and put the website right next month when I come to adding this year's opinions. I am, needless to say, full of anticipation for next weekend. Digging into the stats, Georgia's success last years seems to be entirely my fault: I must've had a funny moment and got distracted by the sparks. I think we're definitely going to have to revisit the Top 5s to make them into Top 10s: France, especially, is very poorly served: the shortlisting was a bit rushed when we came to doing the reviews last year. I too think it would be good to extend that project: I'll have to see if I can convince the other half of the jury to do it!
ReplyDeleteThanks again for your comments and your corrections, and for taking the time to read the thing! It really is very much appreciated.
Best wishes, and I hope you enjoy this year's contest too!
Steph