[Game) 6 Degrees

How does it know how far to swing and everything, where will it swing and so on?