This looks a little like determining slot machine payouts for reel positions.
In reply to Re: Regex matching on grid alignment by boftx in thread Regex matching on grid alignment by Anonymous Monk