From Kook Science
On the subject, T. T. Timayenis in A History of the Art of Magic (New York: J. J. Little, 1887), p. 24-25, relates the following:
Alectryomancy was an ancient kind of divination which attempted to foretell events by means of a cock, and was employed among the Greeks in the following manner: A circle was made on the ground and divided into twenty-four equal portions or spaces; in each space was written one of the letters of the Greek alphabet, and upon each of these letters was laid a grain of wheat. This being done, a cock was placed within a circle and careful observation was made of the grains he picked up. The letters corresponding to these grains were afterward formed into a word, which word was the answer decreed. It was thus that Libanius and Jamblichus sought who should succeed the Emperor Valens. They pronounced certain mysterious words, and examined which would be the first letters discovered by a young cock which they kept without food for some time. The first letter was the Greek letter Theta (Th), the second the Epsilon (e), the third the Omicron (o), the fourth the Delta (d), and thereby they came to the conclusion that the name of the successor would begin by Theod. Upon this the Emperor Valens put to death several of those supposed to aspire to the throne and whose name commenced by Theod; as, for instance, Theodestes, Theodulos, Theodoras, Theodotes, etc. He forgot, however, Theodosius, who succeeded him, and who received the epithet of the Great.
The magicians attributed to the crowing of the cock the power to break up the meetings of apparitions and spectres. Thus, in the play of Hamlet, Horatio, speaking to his friend Hamlet about the ghost, says:
"My lord, I did. But answer made it none: yet once, methought,
It lifted up its head, and did address
Itself to motion, like as it would speak:
But, even then, the morning cock crew loud:
And at the sound it shrunk in haste away;
And vanished from our sight."