Need to find an algorithm

|

I'm looking for an algoritm to help with the kiosk/point-of-sale project I'm working on.

I need to be able to allow customers to add an item to their order for free when they purchase a specific set of items.

Basically, a 'buy three get one free' scheme. Unfortunately, the requirements are such that the three items are not necessarily going to be the same thing.

If anyone has any ideas, let me know.