(The word frame in the following text does not mean an actual frame, it is used as a placeholder for an undefined time unit)
The task
Imagine you have a keyboard layout with only letters like so:
q w e r t y u i o p
a s d f g h j k l
z x c v b n m
Whenever you press a key, for example f
, the keyboard lights up the keys around it each frame like this (unordered, each line is a separate frame):
F
RTGVCD
YHBXSE
UJNWAZ
IKMQ
OL
P
As you can see, each frame lights up the keys around the ones that were lit previously, but not the ones that have already been lit up before.
After you have determined which keys need to be pressed each frame, you need to visualize them. For each frame, you print out the default keyboard layout (with all of the whitespace), but with the lit up keys uppercased. In our example:
q w e r t y u i o p
a s d F g h j k l
z x c v b n m
q w e R T y u i o p
a s D f G h j k l
z x C V b n m
q w E r t Y u i o p
a S d f g H j k l
z X c v B n m
q W e r t y U i o p
A s d f g h J k l
Z x c v b N m
Q w e r t y u I o p
a s d f g h j K l
z x c v b n M
q w e r t y u i O p
a s d f g h j k L
z x c v b n m
q w e r t y u i o P
a s d f g h j k l
z x c v b n m
Rules
Input will be a single letter, you can choose whether it will be capitalized or not.
Output can be either:
a. An array of multiline strings representing each second of the visualized keyboard
b. A single multiline string with each frame of the visualized keyboard separated by at least one newline
You can output a trailing newline or/and the final keyboard visualization when no keys are lit anymore
Test cases
Input: F
Output:
q w e r t y u i o p
a s d F g h j k l
z x c v b n m
q w e R T y u i o p
a s D f G h j k l
z x C V b n m
q w E r t Y u i o p
a S d f g H j k l
z X c v B n m
q W e r t y U i o p
A s d f g h J k l
Z x c v b N m
Q w e r t y u I o p
a s d f g h j K l
z x c v b n M
q w e r t y u i O p
a s d f g h j k L
z x c v b n m
q w e r t y u i o P
a s d f g h j k l
z x c v b n m
Input: Q
Output:
Q w e r t y u i o p
a s d f g h j k l
z x c v b n m
q W e r t y u i o p
A s d f g h j k l
z x c v b n m
q w E r t y u i o p
a S d f g h j k l
Z x c v b n m
q w e R t y u i o p
a s D f g h j k l
z X c v b n m
q w e r T y u i o p
a s d F g h j k l
z x C v b n m
q w e r t Y u i o p
a s d f G h j k l
z x c V b n m
q w e r t y U i o p
a s d f g H j k l
z x c v B n m
q w e r t y u I o p
a s d f g h J k l
z x c v b N m
q w e r t y u i O p
a s d f g h j K l
z x c v b n M
q w e r t y u i o P
a s d f g h j k L
z x c v b n m
Input: Z
Output:
q w e r t y u i o p
a s d f g h j k l
Z x c v b n m
q w e r t y u i o p
A S d f g h j k l
z X c v b n m
Q W E r t y u i o p
a s D f g h j k l
z x C v b n m
q w e R t y u i o p
a s d F g h j k l
z x c V b n m
q w e r T y u i o p
a s d f G h j k l
z x c v B n m
q w e r t Y u i o p
a s d f g H j k l
z x c v b N m
q w e r t y U i o p
a s d f g h J k l
z x c v b n M
q w e r t y u I o p
a s d f g h j K l
z x c v b n m
q w e r t y u i O p
a s d f g h j k L
z x c v b n m
q w e r t y u i o P
a s d f g h j k l
z x c v b n m