This is a simple on-screen keyboard written in Kotlin.
Code can be found in src/main/kotlin/com/epicstar/OnScreenKeyboard.kt.
For usage of the OnScreenKeyboard
, see:
- The jar: Main.kt
- Unit tests: OnScreenKeyboardTest.kt
I used IntelliJ Community Edition, but you're free to use any text editor of IDE of choice as long as
you use ./gradlew
to build or run. However, you may not have the same linter defined in IntelliJ.
See below for how to use.
- Java JDK 17+:
- Windows Installation using Choco
- Ubuntu:
apt install openjdk-17-jdk
- MacOS using Homebrew
- Text file of search strings. NOTE: You can simply use ./samples/sample.txt
./gradlew jar
The jar will save to ./build/libs
.
Find the jar file
cd build/libs
Now run the jar with ./samples/sample.txt:
java -jar OnScreenKeyboard-1.0.0.jar ../../samples/sample.txt
Or you can use your own txt file!
./gradlew test
On screen keyboards are the bane of DVR users. To help alleviate the pain, one local company is asking you to implement part of a voice to text search for their DVR by developing an algorithm to script the on-screen keyboard. The keyboard is laid out as follows:
ABCDEF
GHIJKL
MNOPQR
STUVWX
YZ1234
567890
Please write a program which scripts the path of the cursor on the keyboard. The program should:
- Accept a flat file as input.
- Each new line will contain a search term
- Output the path for the DVR to execute for each line
- Assume the cursor will always start on the A
- Use the following characters to make up the path
- U = up
- D = down
- L = left
- R = right
- S = space
- # = select
- Comma delimit the result
IT Crowd
D,R,R,#,D,D,L,#,S,U,U,U,R,#,D,D,R,R,R,#,L,L,L,#,D,R,R,#,U,U,U,L,#
Please use whatever technology and techniques you feel are applicable to solve the problem. We suggest that you approach this exercise as if this code was part of a larger system. The end result should be representative of your abilities and style.
Please fork this repository. When you have completed your solution, please issue a pull request to notify us that you are ready.
Have fun.
Here are a couple of thoughts about the domain that could influence your response:
- There is no guarantee that the keyboard layout will continue to be alphanumeric. How might you plan for this in your code?
- What if the interface to get the string changed from a file to stream?