title: Mahjong-solitaire solver algorithm, which needs a speed-up
body: <p>I'm developing a Mahjong-solitaire solver and so far, I'm doing pretty good. However,
  it is not so fast as I would like it to be so I'm asking for any additional optimization
  techniques you guys might know of.</p>
  
  <p>All the tiles are known from the layouts, but the solution isn't. At the moment, I have few
  rules which guarantee safe removal of certain pairs of same tiles (which cannot be an obstacle to possible solution).</p>
  
  <p>For clarity, a tile is free when it can be picked any time and tile is loose, when it doesn't bound any other tiles at all.</p>
  
  <ul>
  <li>If there's four free free tiles available, remove them immediately.</li>
  <li>If there's three tiles that can be picked up and at least one of them is a loose tile, remove the non-loose ones.</li>
  <li>If there's three tiles that can be picked up and only one free tile (two looses), remove the free and one random loose.</li>
  <li>If there's three loose tiles available, remove two of them (doesn't matter which ones).</li>
  <li>Since there is four times the exact same tile, if two of them are left, remove them since they're the only ones left.</li>
  </ul>
  
  <p>My algorithm searches solution in multiple threads recursively. Once a branch is finished (to a position where there is no more moves) and it didn't lead to a solution, it puts the position in a vector containing bad ones. Now, every time a new branch is launched it'll iterate via the bad positions to check, if that particular position has been already checked.<br>
  This process continues until solution is found or all possible positions are being checked.</p>
  
  <p>This works nicely on a layout which contains, say, 36 or 72 tiles. But when there's more,
  this algorithm becomes pretty much useless due to huge amount of positions to search from.</p>
  
  <p>So, I ask you once more, if any of you have good ideas how to implement more rules for safe tile-removal or any other particular speed-up regarding the algorithm.</p>
  
  <p>Very best regards,
  nhaa123</p>