Tuesday, June 22, 2010

Perfect Score in Entanglement!

Update 2/9/11: This post is from prior to our update on how scores are calculated. At the time that this post was written, the number of line segments was the score. You can still only get a maximum of 169 line segments (the number in the center), but your score gets a bonus determined by how many line segments you can complete in a single move (the upper left number). Sorry for the confusion!
One of the limits of the solitaire game board is that the highest theoretical score possible is 169. That high score is no longer just theory: 'atomic' commented on the Jay is Games review with a screenshot of the perfect score! Truly impressive.

55 comments:

  1. Hi there,

    I have observed a problem with Entanglement; where should I send a bug report? There's no contact information anywhere on your site.

    ReplyDelete
  2. Hi Rose, you can post the issue you found here as a comment, or email feedback@gopherwoodstudios.com - I suppose I should post this email address on the site somewhere :-)

    ReplyDelete
  3. Interestingly, the way to get the top score is to ensure two things;

    1. EVERY piece touching the edges, which includes the center pillar, connects an edge "point" with another edge "point". AND

    2. There are no isolated loops.

    It would be interesting to try and calculate the probability of constructing suck a maze, especially since you can't control what kinds of pieces you get, nor where're they're placed when they arrive.

    (Ie, this is a rather mathematical way of saying "hax!")

    ReplyDelete
  4. Way too geeky here:

    To obtain a perfect game, at a minimum the pieces abutting the hub, corners and edges need to have lines that, after rotation, can join all the edge-touching points together. Ie, non-edge touching points are NOT wasted by leading to an edge.

    So, we working on the probabilities of obtaining the necessary pieces for those locations.

    Number of pieces (excluding similarities due to rotation): 10395 ( 11 * 9 * 7 * 5 * 3 )

    Looking at two edges, number of ways of joining: 3
    For remaining 4 edges, number of combinations: 105
    6 combinations of two adjoining edges having all points joined.

    => number of valid pieces for "outside edge": 1890/10395


    Looking at three edges, number of ways of joining: 15
    Remaining 3 edges, joining: 15
    6 combinations of three adjoining edges

    => number of valid pieces for "outside corner": 1350/10395


    assuming top edge is fixed (looped to itself), number of ways of combining remaining 5 edges: 945
    6 combinations, again.

    => number of valid pieces for inside hub: 5670/10395


    (All these figures are "high" given I haven't excluded the duplicated configurations)
    (Also, we have not reduced more peices to avoid creating internal loops)


    5 correct hub pieces required + 6 correct corner pieces + 12 correct edge pieces


    (1890/10395)^12 * (1350/10395)^6 * (5670/10395)^5 =

    Maximum Probability of obtaining pieces necessary for a perfect game =

    3.0234041242280446e-16

    Ie, roughly 0.0000000000003 %

    ReplyDelete
  5. Oh! I didn't see the "two tile" mode... okay... that makes it A LOT easier to obtain perfect gameage. (Javascript debuggers notwithstanding ;) )

    ReplyDelete
  6. Ch'marr - that's pretty fascinating. This might help clean the duplicates out of your calculations:

    I'm relatively certain there are 2139 unique tiles (once you remove rotations, order of lines plotted, etc): 1 + 1*2 + 3*1*2 + 5*3*1*2 + 7*5*3*1*2 + 9*7*5*3*1*2 = 2139

    Also, Firefox seems to give a disproportionately larger number of single-side loop-backs than the other browsers, which really messes up clean math - the next update will fix that though. :-)

    ReplyDelete
  7. Hmm... that's odd.... 2139 * 6 (putting the rotations back in) comes to 12834 tiles, which is much higher than my 10395. Geek senses tingling... will likely be plotting this one out much more studiously tonight.

    (Nothing like brute force coding to prove something ;) )

    HOWEVER, assuming that the piece generator is purely "mix the edges up" random, then its more likely to generate pieces that are "rotation duplicates" of others, so its better to plot ALL combinations of pieces that way, and just determine which ones are applicable.

    ReplyDelete
  8. Derek: How did you come up with your "2139" ? I tried to attack the problem a slightly different way, and came up with the same 10395. I'm still assuming that rotation is signfiicant:

    Number of possible ways of constructing pieces, assuming path direction AND order paths are placed, are important:

    12! = 479001600

    Since neither order paths are joined, nor the direction of the path, affects the appearance of the piece, nor changes the probability distribution, we can remove these variations from the pool

    Removing path directions as important:

    479001600 / 6^2 = 7484400

    Removing order paths are placed as important:

    7484400 / 6! = 10395


    However, what really puzzled me is... I should be able to divide this by 6 to make rotation insignificant, but that number is not divisible by 6. I suspect this is because some pieces, such as a piece that has tight loops at every edge are only represented ONCE in the "10395" figure

    ReplyDelete
  9. Okay, yes, I'm convinced that's right. Even if piece A can be rotated to look like a piece B, they need to be considered separately because both A and B have the same probably of appearing. A piece "C" that is identical after rotation (for example, our piece that is completely tight loops) has no greater chance than piece A OR B, but not A and B combined.

    If the random piece generation algorithm was changed to change the distribution - for example, generating a random number 0..2138 and from THAT number selecting a piece - then this would be a totally different conversation :)

    ReplyDelete
  10. That makes perfect sense. I hadn't considered that the piece generating code wasn't supplying an even distribution of the 2139 possible pieces (ignoring for the moment the FF bug). Although it may be better this way, because it's the ones that are identical on rotation that are 1)least likely to appear and 2)the least fun to play.

    Not that it's relevant at this point, but I found the scribbling that helped me determine there are 2139 pieces: http://bit.ly/b7o5Ei

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Ch'marr, Derek: Burnside's lemma's good for these sorts of things, though in this case it's a little messier than it might be given that we then have to subcount by the number of edges straight across in some cases. Anyway I'm getting [(11*9*7*5*3*1) + (10*6*2 + 6choose2*6*2 + 6choose4*2 + 6choose6) + 2*(9*3) + 2*(6 + 6choose6)]/6 = 1799 distinct tiles up to rotation.

    Anyway, I also noticed that there seemed to be many more friendly tiles, i.e. those that can block off all the points of two or three adjacent wall edges, coming up than one might expect. So I dived into the source wondering how the tile distribution was being weighted. And I was wholly surprised to find that it was just shuffling the endpoints into six pairs:

    this.generate = function ()
    {
    this.pairs = [0,1,2,3,4,5,6,7,8,9,10,11];
    this.pairs.sort(function (a, b){return (Math.random()*3) - 1;});
    }

    with a lazy nonuniform shuffle that surely violates the precondition contract of sort. So we have the whims of JS's implementation of sort to thank for the fact that perfect games are feasible!

    (Oh, and what harm would come of allowing <tt> or <pre> tags in these comments?)

    ReplyDelete
  13. Derek: thanks for the pic!

    Alex: thanks for the timesink! ;) Actually, I was more interested in including the distribution into the probability, rather than finding the number of totally unique tiles, and, you're right, the "unsort" is probably very broken and my attempt at getting an accurate probability is... dubiously founded! :)

    ReplyDelete
  14. PS: Derek... is that a picture of a lego house in the background? :)

    ReplyDelete
  15. @Alex, thanks for your input! Concerning the number of tiles - I will take your word for it - I'm a bit of a neophyte when it comes to combinatorics. My '2139' method looks like it fails after the 4 sides I drew out: the pattern it seems to imply won't continue as such due to rotational duplicates of a kind that won't appear until after the 4 sides I drew.

    Concerning the shuffle - yeah, on review I could probably make it a bit better :-). Creating the full set of possible tiles to randomly select from looks like it may be the best way to go at this point.

    Regarding tags - I don't believe I can do that with Blogger comments. I checked but couldn't find anything in the settings.

    @Ch'marr, it's actually voxel art I created using a very fun web tool called Q-Block. If you enjoy Legos, you'll probably love this site.

    ReplyDelete
  16. You guys confused me with your math equations. Anyways cool game, and I'm totally addicted to it. My top score is sadly 71 at the moment. It will improve...

    ReplyDelete
  17. I'm glad you're enjoying it, Jani and Brian.

    @Jani - Two Tile Tangle should help prevent that from happening :-)

    ReplyDelete
  18. Crap. I just found this game through another blog post and now I'm hooked. 77 is my best but I'm learning. I've already lost two hours of productivity today and it's just lunch time.

    Thanks a lot guys...

    ReplyDelete
  19. Here's a possible way to increase scoring and continue making the game "competitive": bonuses for multiple-hex jumps. So if your string goes through 5 segments, you get a x5 multiplier bonus. More segments at once mean a higher score overall!

    Instead of changing the original game, this higher-scoring version could be locked initially, much like the Two Tile Tangle...maybe after 100 points?

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. I love Chris's idea about a multiplier-bonus version. It would improve the long-game aspect, choosing a meager placement to benefit your score later. As it is, Entanglement is awesome, so I do agree that this should be an optional version, unlocked at some point.

    P.S. If I flunk out of grad school due to playing your game all the time, you will be hearing from me again ;)

    ReplyDelete
  22. Damn, I've only managed 103, love playing it though, great to get your synapses firing :)

    ReplyDelete
  23. Alas - no longer working in Firefox 3.6

    Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "http://gopherwoodstudios.com/entanglement/j/audio.js Line: 18"]

    Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "http://gopherwoodstudios.com/entanglement/j/entanglement.js Line: 453"]

    Error: aAudioClip is not a constructor
    Source File: http://gopherwoodstudios.com/entanglement/j/entanglement.js
    Line: 587

    ReplyDelete
  24. Thanks for the note tallsteve! It appears that you have security settings on your browser that prevent local storage (used for storing your preferences); I'll see if I can add an allowance for that to keep it from breaking altogether over such a minor issue.

    ReplyDelete
  25. My son just got a 172 on this game. My highest score was 154 and he beat me. I didnt believe him till i went to his pc and saw it. lil fugger.

    ReplyDelete
  26. p.s. his score of 172 means that the highest score possible is NOT 169.

    ReplyDelete
  27. p.p.s. He just got a score of 177.

    ReplyDelete
  28. Hi cachcoco,

    This post is from prior to our update on how scores are calculated. At the time that this post was written, the number of line segments was the score. You can still only get a maximum of 169 line segments (the number in the center), but your score gets a bonus determined by how many line segments you can complete in a single move (the upper left number). Sorry for the confusion! I'm glad you and your son are enjoying the game!

    ReplyDelete
  29. Sir Derek, Thanks so much for letting me know! My son and I are having a blast challenging each other with this amazingly addictive game. I'm winning so far with a 183! woots! Be well and best wishes to you and yours. Sincerly, The Thomas Family

    ReplyDelete
  30. Can one play this game offline? :)

    ReplyDelete
  31. im having horrible issues with chrome apps for this game. I have played it no problem for weeks and now everytime I try to play it threw the app or come to your website and try to access entanglement it crashing chrome. Ive sent to google asking for help and got nothing there so thought I would ask here.. any ideas what could be going on? Im going threw withdrawls here.

    ReplyDelete
  32. Terribly sorry about your issues Kathy. We haven't changed anything recently, so this is quite perplexing. You can try the "non-app" version by going here: http://entanglement.gopherwoodstudios.com/light. Let me know if that works any better!

    ReplyDelete
  33. My current hi-score is 228. Got a screenshot for proof.
    -vovikb50

    ReplyDelete
  34. Ok, improved to 231.
    The highest achieved so far (according to scoreboard) is 3450. Must be random... or hax.

    ReplyDelete
  35. so how in the world is the high score list showing scores in solitaire going above 1000. I don't see it as possible and after googling and finding this page I still don't see how those scores were achieved and posted online. Are they possibly placeholders?

    ReplyDelete
  36. Hi everyone, I am updating this post tonight to reflect the new scoring system so it's not as confusing.

    ReplyDelete
  37. I just did what I thought was a fair score of 200 path of 84, yet the top score is 1326? Is a score over 1000 possible?

    ReplyDelete
  38. I can't seem to break 200 (best is 198). How in the heck are people scoring so high!?

    Love the game; so addicted! My husband and I like to see if we can best each other's scores. So far, I'm winning. :)

    ReplyDelete
  39. i got 266 but i feel like a damn fool utilizing all my concentration and 1000 above seems like a... *shudders* :(

    ReplyDelete
  40. KATHY!! The same crash issue happened to me as well. played it once last week now it crashes Chrome every time I attempt to open the app.

    ReplyDelete
  41. 169 is non sense i have 181 and above 169 more than 2 times

    ReplyDelete
  42. Hi Aaron (and Kathy), we've had some odd issues with conflicting extensions, so I would encourage you to try temporarily disabling them and see if it performs better. If you notice which Chrome extension causes Entanglement to crash, please let us know :-).

    Faceless void: 169 is maximum segments, not score. We've changed the scoring system since this blog post.

    ReplyDelete
  43. There must be some trick to this, because I have never been able to reach even 200 points. No matter what I try, what am I doing wrong? I do try to make my lines as long as possible, but I don't see how anyone can reach those high scores.

    ReplyDelete
  44. Hey, LOVE the game. my personal best is 235. watch this vid (not me) http://www.youtube.com/watch?v=4NOQgIqczIU it helped alot for the strategy side of this game. Before I watched this video i was scoring low 70's and the first game after i scored 235.

    ReplyDelete
  45. I agree...the game is great (and completely addicting). But those posted high scores, esp. the daily ones of more than 2,000??? How in the world...I'd like to see one of those as an example somewhere. My personal high so far is 351, and that was only once (usually around 200).

    ReplyDelete
  46. PS: agree with Robert, "undo" button would be great (even if just able to use it once per game)

    ReplyDelete
  47. Who cares... the URL is wrong anyways: theirs says gopherwoodstudios.com/entanglement/?n=1a
    The real one says: http://entanglement.gopherwoodstudios.com/

    Unless that's just for me...

    ReplyDelete
  48. This comment has been removed by a blog administrator.

    ReplyDelete
  49. The impressive thing to me in the perfect game above is that the line re-enters the hub in the same tile it came out. This has to be true for it to be the perfect game.

    ReplyDelete
  50. This comment has been removed by the author.

    ReplyDelete
  51. On or near Dec 1, 2012 the perfect score 9080 was posted by player 'Mysterious Creative Chipmunk'... very impressive... But since 'Mysterious Creative Chipmunk' also posted a score of 8688 - both scores being quantum leaps above previous highs - I suspect 'Mysterious Creative Chipmunk' has utilized a "creative" method to bypass the rules of play. Winning the lottery twice is possible... but on the same day??? Is there a way to confirm/disprove these scores???

    ReplyDelete
  52. Thanks Chris, I checked our log data on both of those submissions: they were indeed injections and have been removed.

    ReplyDelete

Please keep the conversation healthy and wholesome.