~rabbits/orca-toy

bac1a549ebea0faad8e0e75a56044e1526e7951b — neauoire 2 years ago abca909
Implemented wires
2 files changed, 25 insertions(+), 9 deletions(-)

M demo.orca
M toy.c
M demo.orca => demo.orca +7 -7
@@ 1,7 1,7 @@
.............
.............
.....S.......
.............
.............
.....:03C45..
.............
..S.............
................
..J.............
..J.............
..J.............
...YYYY.:03C....
................

M toy.c => toy.c +18 -2
@@ 252,7 252,15 @@ opi(Grid *g, int x, int y)
void
opj(Grid *g, int x, int y)
{
	setport(g, x, y + 1, getport(g, x, y - 1, 0));
	int i;
	char c = get(g, x, y);
	char link = getport(g, x, y - 1, 0);
	if(link != c) {
		for(i = 1; y + i < g->h; ++i)
			if(get(g, x, y + i) != c)
				break;
		setport(g, x, y + i, link);
	}
}

void


@@ 397,7 405,15 @@ opx(Grid *g, int x, int y)
void
opy(Grid *g, int x, int y)
{
	setport(g, x + 1, y, getport(g, x - 1, y, 0));
	int i;
	char c = get(g, x, y);
	char link = getport(g, x - 1, y, 0);
	if(link != c) {
		for(i = 1; x + i < g->w; ++i)
			if(get(g, x + i, y) != c)
				break;
		setport(g, x + i, y, link);
	}
}

void