Example #1
0
            public point moveto(point cin_p, int direciton)
            {
                point tmp = new point(cin_p);
                int   buffer;

                switch (direciton)
                {
                case 0:
                    buffer = tmp.state[tmp.x - 1, tmp.y];

                    tmp.state[tmp.x - 1, tmp.y] = tmp.state[tmp.x, tmp.y];

                    tmp.state[tmp.x, tmp.y] = buffer;

                    break;

                case 1:

                    buffer = tmp.state[tmp.x + 1, tmp.y];

                    tmp.state[tmp.x + 1, tmp.y] = tmp.state[tmp.x, tmp.y];

                    tmp.state[tmp.x, tmp.y] = buffer;

                    break;

                case 2:

                    buffer = tmp.state[tmp.x, tmp.y - 1];

                    tmp.state[tmp.x, tmp.y - 1] = tmp.state[tmp.x, tmp.y];

                    tmp.state[tmp.x, tmp.y] = buffer;

                    break;

                case 3:

                    buffer = tmp.state[tmp.x, tmp.y + 1];

                    tmp.state[tmp.x, tmp.y + 1] = tmp.state[tmp.x, tmp.y];

                    tmp.state[tmp.x, tmp.y] = buffer;

                    break;
                }

                tmp.getblanck();

                return(tmp);
            }