I think I understand the problem.
The Javascript has no (documented) way to return the actual pattern
that was input by the user, only a matched/failed test.
That forces the app to hard code a pattern,
instead of asking the user to trace one.
Here's a way to INPUT a pattern from the user ...
Show a full screen canvas and RESET & OK buttons.
On the canvas, evenly space 9 Balls.
Load a global list Balls with their components, for special effects like flashing them by index.
Keep an initially empty global list Pattern, with the indices of the Balls that were touched.
Set up TouchDown (Dragged?) events for Ball1-9, calling a common procedure AddBall with that Ball's number(1-9):
AddBall(n):
if is empty list(Pattern) then
add n to list Pattern
else if not(last item in list Pattern = n) then
end AddBall
When OK button clicked,
output list Pattern.
When RESET button clicked,
set list Pattern to empty list.
To make it fancy, you could have a Clock
temporarily inflate and deflate the balls in list Pattern
to remind the user of his pattern, or draw lines from ball to ball
between canvas erasures.
ABG