Exemplo n.º 1
0
        static IEnumerable <CPos> RandomWalk(CPos p, Thirdparty.Random r)
        {
            for (; ;)
            {
                var dx = r.Next(-1, 2);
                var dy = r.Next(-1, 2);

                if (dx == 0 && dy == 0)
                {
                    continue;
                }

                p += new CVec(dx, dy);
                yield return(p);
            }
        }
Exemplo n.º 2
0
        static IEnumerable <int2> RandomWalk(int2 p, Thirdparty.Random r)
        {
            for (; ;)
            {
                var dx = r.Next(-1, 2);
                var dy = r.Next(-1, 2);

                if (dx == 0 && dy == 0)
                {
                    continue;
                }

                p.X += dx;
                p.Y += dy;
                yield return(p);
            }
        }