This was placed at a doorstep of a shop selling ceramics, somewhere in Pontochō, Kyōto.
It’s some sort of a game (maybe derived from kendo practice). My neighbours’ kids did this on a birthday party and were instructed by their Japanese mother.
One Kid gets blindfolded with a piece of cloth and then turned around three times. Now it may hit three times with the stick, just guessing and not knowing where the melon is. Then it’s up to the next kid to hit three times and so on. The game is over when the melon is smashed to pieces.
(Sorry for my awkward description in bad English!)