wrote a much better implementation of stones on the table