So what I gather from your code, is this:

```
Set up a 3x3 Matrix
Wait until user presses a keycode above 70
If keycode is in the interval (70,80], B is 8
If keycode is in the interval (80,90], B is 6
If keycode is in the interval (90,105], B is 4
You take the iPart of the keycode, which will be in the set {7,8,9, 10}, subtract C, and add 10fPart of the keycode which will be in the set {1,2,3,4,5}
-- continued in next box --
```

This is where it gets tricky. What we know now is that A will be one of the numbers in the set {8,9,10,11,12,13,14,15}, minus C. It is important to note that certain keys such as 72 and 81 will result in the same A although they have different B's. It would be helpful to know what C is, since I don't see it being set anywhere in the code.

```
-- continued from above --
"If int(A/3)" will always be true, as long as A is not 0 or 2 so A equals A-1.
At this point, A is one of {7,8,9,10,11,12,13,14} minus C
If you take int(A/3)+1, and store it to X, it has to be in the set {1,2,3}, so int(A/3) has to be in the set {0,1,2}. Which means A has to be between 0 and 8. Because of this, C has to be either 6 or 7
3fpart(A/3) also has to be in the set {1,2,3}. This means that A cannot be divisible by 3, since it will result in 0 if it is. 3fpart(A/3) can result in {0,1,2}, so you really should be using 1+3fpart(A/3)
```

I probably didn't explain all that the best I could have, but basically the lines where you set X and Y are dependent upon what A and C are. You should change $3fpart(A/3$ into $1+3fpart(A/3$ because if A is divisible by three it will result in 0. If C is anything other than 6 or 7, your code won't work either. I think you may need to double check your if statements or make sure you're using `int(` in the right way. If you need more help, posting the full code as well as the purpose of the code would be the easiest way