All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
If the mentioned game involves paying a specific sum of money in return for a specific amount of candy that the player grabs from the machine, then it is permissible to play it. But if the player pays money and does not know the amount of candy he shall receive in return and he may or may not get the candy, then this falls under the prohibited gambling. If you had taken candy that is worth more than what you paid, you are required to return the extra money to the owners if possible; otherwise, you should give it out in charity. If you do not know the exact amount of the extra money, you should make an estimate and give out what you believe would most likely clear you of your liability.
As for the poker game, if the money the player wins is virtual and of no value, then he is not liable for it.
Allah knows best.