The machine senses when something is in front of it using the infrared sensor, which triggers the sequence of delivering (throwing) a mini chocolate. All the details of how it works can be seen in the video and all the building details can be found on my website.
All the pieces you need to build it come in the retail EV3 kit (31313).
I ate way too many mini chocolates while designing this. :)
Waiting for Inventory to load