Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
words = %w(ボ ン ジョ ヴィ ・)
expected_sequence = [2, 1, 4, 0, 1, 4, 2, 3]
state = 0
count = 0
while expected = expected_sequence[state]
actual = Random::rand(words.size)
state = (actual == expected) ? state+1 : 0