Category: Not Roguelike

Winnable Mahjong layouts…

Wow, people really like Badges!  My mahjong game (3D Mahjong Solitaire) has been out there for a month or so with just a “free play” mode, and had received a bunch of very positive reviews.  Last week I added “Champion Mahjong” mode, in which you complete tables to acquire Badges (similar to Xbox LIVE achievements).  Unfortunately, the tables as they were defined were way too difficult – e.g. requiring 100 tries to pass in some instances.  The net result is that everyone got stuck on the few tables, and the negative reviews began pouring in (each one = pain).

I put a bunch of effort into generating “guaranteed winnable” layouts – and pretty much failed the first time.  The problem was that I wasn’t testing the results, and doing to much assuming.  So, I got creamed in the reviews again last night/today (ouch again :P).  The other challenge is that building guaranteed winnable mahjong tables is actually a pretty tricky problem; everything I could find on the internet talked about “just play the game backwards” – which it turns out is a load of tripe.  More on that in a moment…

So, I took a step back and created a “headless” version of the Mahjong code which could automatically play all of the tables a bunch of times, and allow me to do some statistical analysis on the win/loss ratios of them all.  Here’s what I saw with the currently posted “guaranteed winnable” logic after playing through every table 100 times each:

Putting that into English:  many of the tables were completely unwinnable!  OhmigodDOH moment for sure.  And this is after I posted a comment and an update saying that the problem had been fixed.  No wonder people were flaming the game in the comments; I was half-tempted to do so myself! ><…

So, back to the “guaranteed winnable” algorithm:  after playing and playing and playing around with the “play it backwards” approach, I increased the overall win/lose ratio by a whopping 3%.  Yeah, that would stop peoples’ frustration :P.   The problem is that the “guarantee winnability by playing the game backgrounds” approach doesn’t guarantee winnability.  Simplest example is if you had a layout with 4 horizontally arranged tiles, you could start by placing a pair of matching tiles in the 1st and 3rd positions; and you’d be left with the 2nd and 4th positions for other pair of tiles – resulting in an unwinnable board.

I fought with this left and right before taking a step back and realizing that there was a much better approach: play the game “forward” (like a human would), picking any two “free” tiles and ignoring their tiletype; then just remove those tiles from the board, set those tiles to matching types, and continue on your merry way until the table is empty.  At that point, you just put all of the tiles back on the table with their new matching styles.

When trying the “play it backwards” approach, the “GetAvailableTile” function grew to 100 lines of gobbledegook. But with a “play it forward” model, it’s dead-simple:

        static Tile GetAvailableTile(Tile dontmatch)
            int offset = RandomMgr.Next(RemainingTiles.Count);
            for (int i = 0; i < RemainingTiles.Count; i++)
                Tile tileToRemove = RemainingTiles[(offset + i) % RemainingTiles.Count];
                if (dontmatch == tileToRemove)

                if (tileToRemove.IsFree)
                    return tileToRemove;

            return null;

So now when I run the analysis tool, I get an average win/loss ratio of 45% which is MUCH better:

Wonderful!  Now a “dumb” computer can solve almost all of the puzzles in just a few tries…

Next up, intuitively you’d want the tables to get progressively harder.  Now that I’ve got the analysis tool, I can just sort by the Win/Loss ratio in Excel:

And now I know what order to place the tables in so that it gets harder as you go.  Furthermore; when I add a new table, I can simply run the tool against it and tweak the table so that its difficulty is at an appropriate level.

Finally, you’ll notice that the last few levels are still too difficult; indeed, Table 21 was impossible for the “dumb” computer to solve!  So now I have the knowledge and tools with which to go back into the layout editor, tweak those layouts until they’re closer to a ~.15 win/loss ratio (what I’d consider appropriate for the hardest levels), and then the whole string of tables should be doable, the earlier badges will be easier and the later badges should be harder to get (as they should be), and everyone goes back to spending time enjoying the game instead of posting frustrated comments :-).

So: morale of the story: Don’t assume; statistical analysis rocks.  When 7YRL gets to the “level balancing” stage, I’ll be doing a heck of a lot more of this at that point!

(Oh, and finally: you might ask why I’m spending all this time writing this post when I haven’t actually submitted the update yet.  It’s because MS’s submission process – which in almost all ways rocks – sucks when you’ve got an update in the queue that you want to override.  I need to wait for that update to go through, and then can submit this fix.  So, more waiting – and more frustrated players in the meantime… ><…)

UPDATE (4/17 @ 12:49PM PST)

I’ve just completed the work described above.  This required reordering the tables and making some tweaks to the tables with too-low win/loss ratios.  After all of that was done, here’s what the new stats look like:

Things to note:

  • All Win/loss ratios are at .15 or above.  My assumption is that a good human player can probably double win the rate of a “dumb” computer, so the harder levels will take them about 3 tries to pass.  That’s about right, and leaves me some leeway to add harder levels without getting too hard.
  • The table difficulties smoothly decrease, meaning that the earlier levels are easier and the harder levels are harder (as you’d expect).
  • There’s three exceptions to the smoothly-decreasing: Tables 8-10 get really easy.  Although I could have left them up at the front, I opted to move them  in a little ways because the table layouts are pretty sparse and not a good introduction to the gameplay.  Over time I can look at increasing the difficulty of those levels so that they fit in better difficulty-wise.  But the user won’t really be able to tell either way…

So, now the waiting begins for MS to publish the update that they’re currently testing, and then I can submit :P…

To those of you coming here from my comment in the Wp7 Marketplace review for my game – thanks for your patience, and please up-rate your rating once the new checkin goes in! 😉



Up another 5 in the list of all WP7 marketplace apps to #60.  #29 in the list of all free games, which means it finally appears “above the fold” in the Zune top apps list on my 24″ monitor :).

Yes, it’s more popular than not only YouTube, but people apparently like the game more than they like Sexy Babes.  FREE ones, even!

I’m apparently going to need to spend a little more time on it; the latest review says “Been playing mahjong for years and I am completely stuck on the second puzzle for a badge, been literally playing it ALL day and just can’t seem to get past it, is this thing set to expert???”.  On the one hand; awesome that he’s playing it all day ;-).  On the other hand, not awesome that it’s so hard (I’ve noticed the same thing).  I’m going to look into updating the table generation code to place tiles in a guaranteed winnable fashion (placing the tiles by basically playing it backwards).  It’ll also give me an excuse to drop a “my other games” button onto the main menu ;-).

So, that’ll likely take the bulk of my “free” time this weekend, and Dungeon won’t get as much love…

It’s up to #65 (from #80 three days ago) out of all 13,000 apps in the WP7 marketplace!  It’s up to #40 (from #45) out of all games,  and #31 (from #36) out of all free games…


Mahjong keeps climbing…

Cracked the top 100 and shot on up! It’s up to #80 out of all 13,000 apps on the WP7 marketplace! #45 out of all games, and #36 out of all free games…

Yep: it’s currently slotting higher than games that not only have TMs and Rs after their name, but are both qualitatively and quantitatively far superior to mine :).  But I’ll take it!


I had to get up at 1:30 this morning and work pretty much straight through to get it done, but I’m done!  I’ve just posted the update to my 3D Mahjong game which adds a whole new game mode and “Badges” (the non-LIVE equivalent of Xbox LIVE Achievements).  I’m hoping this’ll help drive (a) usage [read: ad$] and (b) more user affinity.  At this point, the game is about as close as you can get to a WP7 LIVE title without actually hooking into LIVE…

Related: the free version is now up to #49 of all Games, and #90 of all applications on WP7.  Yep, I’ve cracked the top 100!  This is pretty awesome, and the following shows how it’s now more popular than Assassin’s Creed ;-).

Here’s what the badge album/”champion mode” looks like:

The free and paid versions have been submitted, and so now the waiting game begins (although MS is pretty fast).  After that, it’s praying-and-hoping time that I didn’t miss some major bug :P.

Anyways, from a 7yrl POV this means that (a) I can focus on it more again, and (b) I’ve now got a global Badges system that I can leverage here when I get to it.


More cool WP7 stats

Random stats about my WP7 games.


My Windows Phone 7 games are doing pretty well:


Wow – no wonder Google’s so big.  My 3D Mahjong game is pulling in around 9,500 impressions per day with an eCPM of around $15.  Doing the math: it’s pulling in around $150 per day from ads alone!  That’s almost an order of magnitude more than the $1 version (without ads) is making.  Today it’ll cross the $1k earned mark for April.  I really, really wish I’d converted to Ads sooner ;-)…

Driftwood Solitaire is doing okay (~$15 per day from ads), but nowhere near as good. Clearly 3D is the way to go; I’ve wracked my brain for ways to take the 3D Mahjong engine and crank out some other 3D tile-based game, but can’t think of anything :P…

Some charts – first, impressions per day over the last month:

And second, revenue per day.

Is it really any wonder why I’m cranking so hard on getting the Badges into Mahjong? ;).

And a random note: Wuff, it’s both really nice and really painful to read the comments people leave about your game!



My 3D Mahjong Solitaire game (free version) is the  #102 application out of all 13,000 apps/games (including both free and paid) in the Windows Phone 7 marketplace.  Pretty cool!  I’ve got some features I’m working on now that might help boost it up even higher…


Follow 7yrl on Twitter!

I’ve officially caught up to 2008.  You can get updates about stuff on this site on twitter at



Even though my free Mahjong game has an issue that’s effecting gameplay (fix submitted, now just waiting… and waiting…), it was still able to pull in about $150 in ad revenue in its first full day of availability.  Pretty good, but apparently not the norm.  eCPM (basically, the amount I get every 1000 ad views) dropped precipitously at around 1AM this morning; as in, from around $90 to $1.  O_o!

Here’s hoping it’s a temporary fluke, but based on the flood of posts about this on the pubcenter forums, (a) it’s not just impacting me, and (b) it’s somewhat to be expected :P.

Ah well, guess I’ll stop shopping for retirement homes now…

The WP7 Ad control is currently… twitchy.  Lots of challenges with integrating it, including obtuse error codes (“An unexpected error occurred during response processing (Name: ECN)”) and of course it’s still new, so there’s not a lot of hard data/examples out there.  Combine that with the fact that it seems to only rarely serve any ads and you’ve got a recipe for posting a game in which you believe ads are working, but they’re not.  And that’s what happened to me (d’oh!).

The number of Free downloads easily eclipsed the number of paid downloads in just a couple of days.  Too bad I’m not making any money off of those ><.

I’ve submitted an updated version of it, but it required about three hours of fighting with the ad control on Monday night (make a change, run the app 20 times to see if I hit upon the magic combination of proper code and of it properly serving an ad). And no, test mode does not help with this.  On top of that, although I’ve seen ads displaying in the game, I have yet to see a second ad display after requesting a new one; so I have no idea if I’m going to now have a game which gives one impression per run, and no way to really know (damnit it).

Ah well.