This is inspired by the excellent Visualize Visual Eyes challenge. It is posted with permission from and credit to @Jordan
We are going to create an ASCII art approximation of the Xeyes challenge but without worrying about the actual mouse movements. Just the positions.
EDIT
I thought about whether this could be seen as a duplicate but I don't believe it is.
The previous question required detecting mouse movement. This does not and so is open to many more languages.This is simple interactive ASCII art which can be attempted in any language.
While the algorithm for the eye movement may be similar, this is in many ways simpler to achieve.
I'm not convinced that any answer given so far to the previous question could be trivially ported to this.
I don't think I am good enough at languages that could answer the previous question to attempt it. I would have a try at this one.
If consensus is that I am wrong then I am happy to delete the question.
I have removed the comment about "interesting answer" as this is intended to be code golf.
Overview
In all cases the mouse position will be represented by an X.
Here are the eyes with no mouse position (cursor is off screen):
/---\ /---\
| | | |
| O | | O |
| | | |
\---/ \---/
Now let's say your mouse is to the right of the eyes:
/---\ /---\
| | | |
| O| | O|X
| | | |
\---/ \---/
and now at the bottom left:
/---\ /---\
| | | |
| | | |
|O | |O |
\---/ \---/
X
and now at the top:
X
/---\ /---\
| O | | O |
| | | |
| | | |
\---/ \---/
From this we can see that (in it's simplest case - we could make it a lot more complicated but let's not do that for now) there are 9 different positions for the eyes and nine different positions for the cursor as shown below:
1 2 3
/---\ /---\
|123| |123|
4|456| |456|6
|789| |789|
\---/ \---/
7 8 9
Position 5 represents no cursor (off screen). The eyes are both looking forward.
The Challenge
Take an integer (or any representation of an integer) between 1 and 9 inclusive and output the eyes if the cursor was in the position of that integer. You must include the X as the position of the cursor (except when it is off screen i.e. the eyes are looking forward - no X).
Rules
Input format is your own choice.
Program or function.
Any amount of leading or trailing whitespace is allowed.
Output must consist only of the characters /\-| and either upper or
lowercase x and o.Assume that the input will always be valid, i.e. an integer between 1 and 9 inclusive.
Feel free to change the order of the integers if it helps i.e. 2 does not have to be top and 5 does not have to be no cursor.
Standard loopholes prohibited as usual.
This is code golf. Shortest answer wins.
Test Cases
Note: All test cases use the numbering sequence detailed in the explanation. As stated in the rules, you do not have to use the same number sequence.
Input = 5
/---\ /---\
| | | |
| O | | O |
| | | |
\---/ \---/
Input = 6
/---\ /---\
| | | |
| O| | O|X
| | | |
\---/ \---/
Input = 2
X
/---\ /---\
| O | | O |
| | | |
| | | |
\---/ \---/
Input = 7
/---\ /---\
| | | |
| | | |
|O | |O |
\---/ \---/
X
This challenge has been in the sandbox for the last week.