Is there a function $f$ such that
$$f(x,y,n)=f(x+y,y-x,n+1)$$ $$f(x,y,n)\neq f(x+1,y,n)$$ $$f(x,y,n)\neq f(x,y+1,n)$$
where $x,y$ are integers, $n$ is a positive integer and the range of $f$ is a finite set? If so, what is the least number of values $f$ can attain?
EDIT: deleted
EDIT: To make the below pattern nicer here is my final suggestion for an additional condition to make this problem non trivial:
For each $x,y,n$ there should exist an $a>0,b>0$ such that for all $k,l$
$$f(x,y,n)=f(x+ak,y+bl,n)$$
(all numbers are integer, n is positive). This basically states that equal colors should have at least one regular vector grid displacement.
My goal is to reduce the number of colors!
EDIT: Sorry, for the confusion. Here is my explanation what's going on and a last attempt to adjust the conditions.

These are three consecutive steps in the animation. In the second picture the square move as to make space for new light blue squares. In the third picture the light blue squares have reached their full size and the process starts again. This is a problem I got with coloring a checker board. If anyone would like to translate a Processing Python to Java and post it on Openprocessing, I'd be happy.
SOLUTION:
Thanks to Michael the animated pattern now works and looks like:

EDIT: I try mod 5 instead of mod 3. How about $$[1,3]\left[\begin{array}{cc}3&2\\3&3\end{array}\right]^n\left[\begin{array}{c}x\\y\end{array}\right]\pmod{5}$$
The matrix is to undo the linear transform in the first condition, and the vector is to make things change when you add or subtract 1 from any number.
The formulas are $$f(x,y,1)=x+3y\mod5\\f(x,y,2)=2x+y\mod5\\f(x,y,3)=-x+2y\mod5\\ f(x,y,4)=3x+4y\mod5\\repeat$$
Or, slightly simpler, $2^n(x+3y)\pmod5$