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,1-8,1-10,2-6,2-8,2-9,3-8,3-10,4-5,4-7,5-9,5-10,6-7,6-8,7-9,9-10",
"11:0-1,0-5,0-8,1-4,1-5,1-8,2-5,2-9,3-5,3-7,3-9,3-10,4-6,4-7,4-8,6-7,6-10,7-10,9-10",
#endif
};
#define int8_t int
#define uint8_t unsigned int
#define int16_t long
#define uint16_t unsigned long
#define int32_t long long
#define uint32_t unsigned long long
#ifndef TRUE
#define TRUE (0==0)
#define FALSE (0!=0)
#endif
#define NULL 0
static unsigned int dotmask = 0xC3;
#define DRAWING_SCALE 0x80
#define CROSSHAIR_SCALE 0x40
#define set_scale(s) do { VIA_t1_cnt_lo = s; } while (0)
#define BRIGHT TRUE
#define normal FALSE
static unsigned char patList[2];
static void drawline_patterned(int y, int x, unsigned char pat)
{
patList[0]=(unsigned char)y;
patList[1]=(unsigned char)x;
*(volatile unsigned char *)0xC829 = pat;
*(volatile unsigned char *)0xC823 =0;
Draw_Pat_VL(patList);
}
static int last_intensity = -128;
static void drawline(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int bright, int dashed) {
long ax1, ay1, dx, dy;
if (bright) {
if (last_intensity != BRIGHT) Intensity_7F();
} else {
if (last_intensity != normal) Intensity_3F();
}
last_intensity = bright;
Reset0Ref(); set_scale(DRAWING_SCALE);
ax1 = ((long)x1-128L); ay1 = ((long)y1-128L);
dx = ((long)x2-(long)x1); dy = ((long)y2-(long)y1);
Moveto_d((int)ay1,(int)ax1);
// id dx is 255, it splits into 127 and 128 - which causes a problem because +128 is not possible
if (dy == 255 || dx == 255) {
// 255-unit long lines are split in three, all others are split in two.
drawline_patterned((int)(dy/3L), (int)(dx/3L), (dashed ? dotmask : 0xFF));
dy -= dy/3L; dx -= dx/3L;
}
if (dy < -128L || dy > 127L || dx < -128L || dx > 127L) {
drawline_patterned((int)(dy>>1L), (int)(dx>>1L), (dashed ? dotmask : 0xFF));
// don't care which way it rounds (>>1 or /2) because this picks up the odd bit:
dy -= dy>>1L; dx -= dx>>1L;
}
drawline_patterned((int)dy, (int)dx, (dashed ? dotmask : 0xFF));
}
static char *mystrdup(const char *s) {
// to ensure writable strings in 'assign' procedure
// No heap on vectrex, so this is a little hacky.
// Fortunately I know we never have more than
// one 'heap' string at a time...
static char copy[255U], *t; // has to be large enough for biggest problem string in layouts.h
unsigned int len;
t = copy; len = 0;
do {
len += 1;
if (len == 255) {
for (;;) ; // halt.
}
*t++ = *s++;
} while (*s != '\0');
*t = '\0';
return copy;
}
static char *mystrchr(char *s, char ch) {
if (!s) return NULL;
for (;;) {
if (*s == '\0') return NULL;
if (*s == ch) return s;
s += 1;
}
}
static int atoui(const char *s) { // we know all inputs are unsigned
int i = 0, c;
if (!s) return i;
for (;;) {
if (*s == '\0') return i;
c = (int)*s++;
if (c < '0') break;
if (c > '9') break;
c = c - '0';
i = i * 10 + c;
}
return i;
}
static uint8_t _x, _a, _b, _c;
static void initRandom(unsigned int s1,unsigned int s2,unsigned int s3, unsigned int x0) {
_x = x0; _a = s1; _b = s2; _c = s3; _x++; _a = (_a^_c^_x); _b = (_b+_a); _c = ((_c+(_b>>1))^_a);
}
static uint8_t random8(void) { // assert returns unsigned value that fits in an int.
_x++; _a = (_a^_c^_x); _b = (_b+_a); _c = ((_c+(_b>>1))^_a);
return _c;
}
// mouse clicks will select a node only if they are within N units of the node.
// (comparing square of the distance to avoid sqrt() overhead)
#define SLOP_RADIUS 32
#define MAX_CLICK_DISTANCE ((long)SLOP_RADIUS*(long)SLOP_RADIUS)
// under no circumstances greater than 31.
#define MAX_NODES 11 // was (20-5+1)*100 but ran out of ram, so now (11-8+1)*64!
//#include "layouts.h" // levels 8 - 11, 64 per level
typedef struct node {
unsigned int x, y; // on-screen coordinate in 0..255 range. Corrected to -128.127 only on final display.
int links; // count of links to neighbours (2,3,4)
int link[4]; // links to up to 4 neighbours
// int intersects[4];
} node;
typedef struct graph {
int nodes;
node node[MAX_NODES];
} graph;
#define FROM 0
#define TO 1
typedef struct lines { // faster to have a flat array of lines (node pairs), for checking intersections
int node[2]; // from and to
uint32_t intersects;
int isCalculated;
} lines;
static int max_line;
static lines line[MAX_NODES*4];
// no apparent change in cycles regardless of which macro is used:
//#define SAME_SIGNS( a, b ) (((a)^(b)) >= 0)
#define SAME_SIGNS( a, b ) ((((a)<0) && ((b)<0)) || (((a)>=0) && ((b)>=0)))
#define DONT_INTERSECT 0
#define DO_INTERSECT 1
#define COLLINEAR 2
// Discussion of multiple methods at https://stackoverflow.com/questions/3838329/how-can-i-check-if-two-segments-intersect
#define NEW_INTERSECT 1
/* Does fewer 32-bit operations, but still nowhere near fast enough to avoid blackout blink */
#ifdef NEW_INTERSECT
// From https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/
// Given three colinear points p, q, r, the function checks if
// point q lies on line segment 'pr'
#define max(a,b) ((a)>(b)?a:b)
#define min(a,b) ((a)<(b)?a:b)
static inline int onSegment(uint8_t px, uint8_t py, uint8_t qx, uint8_t qy, uint8_t rx, uint8_t ry)
{
return (qx <= max(px, rx) && qx >= min(px, rx) && qy <= max(py, ry) && qy >= min(py, ry));
}
// To find orientation of ordered triplet (p, q, r).
// The function returns following values
// 0 --> p, q and r are colinear
// 1 --> Clockwise
// 2 --> Counterclockwise
static inline int orientation(uint8_t px, uint8_t py, uint8_t qx, uint8_t qy, uint8_t rx, uint8_t ry)
{
// See https://www.geeksforgeeks.org/orientation-3-ordered-points/
// for details of below formula.
int32_t tmp1 = (int32_t)((int16_t)qy - (int16_t)py) * (int32_t)((int16_t)rx - (int16_t)qx);
int32_t tmp2 = (int32_t)((int16_t)qx - (int16_t)px) * (int32_t)((int16_t)ry - (int16_t)qy);
if (tmp1 == tmp2) return 0; // colinear
return (tmp1 > tmp2) ? 1 : 2; // clock or counterclock wise
}
// The main function that returns true if line segment 'p1q1'
// and 'p2q2' intersect.
int lines_intersect(uint8_t p1x, uint8_t p1y, uint8_t q1x, uint8_t q1y, uint8_t p2x, uint8_t p2y, uint8_t q2x, uint8_t q2y)
{
int8_t o1,o2,o3,o4;
// Find the four orientations needed for general and
// special cases
o1 = orientation(p1x, p1y, q1x, q1y, p2x, p2y);
o2 = orientation(p1x, p1y, q1x, q1y, q2x, q2y);
o3 = orientation(p2x, p2y, q2x, q2y, p1x, p1y);
o4 = orientation(p2x, p2y, q2x, q2y, q1x, q1y);
// General case
if (o1 == o2 || o3 == o4) {
// Special Cases
// p1, q1 and p2 are colinear and p2 lies on segment p1q1
if (o1 == 0 && onSegment(p1x,p1y, p2x,p2y, q1x,q1y)) return COLLINEAR;
// p1, q1 and q2 are colinear and q2 lies on segment p1q1
if (o2 == 0 && onSegment(p1x,p1y, q2x,q2y, q1x,q1y)) return COLLINEAR;
// p2, q2 and p1 are colinear and p1 lies on segment p2q2
if (o3 == 0 && onSegment(p2x,p2y, p1x,p1y, q2x,q2y)) return COLLINEAR;
// p2, q2 and q1 are colinear and q1 lies on segment p2q2
if (o4 == 0 && onSegment(p2x,p2y, q1x,q1y, q2x,q2y)) return COLLINEAR;
return DONT_INTERSECT; // Doesn't fall in any of the above cases
} else {
if (
(p1x == p2x && p1y == p2y) || ( p1x == q2x && p1y == q2y) ||
(q1x == p2x && q1y == p2y) || ( q1x == q2x && q1y == q2y)
) {
return DONT_INTERSECT; // end-points are coincident
}
return DO_INTERSECT;
}
}
#else
/* lines_intersect: AUTHOR: Mukesh Prasad, from Graphics Gems II
*
* This function computes whether two line segments,
* respectively joining the input points (x1,y1) -- (x2,y2)
* and the input points (x3,y3) -- (x4,y4) intersect.
* If the lines intersect, the output variables x, y are
* set to coordinates of the point of intersection.
*
* All values are in integers. The returned value is rounded
* to the nearest integer point.
*
* If non-integral grid points are relevant, the function
* can easily be transformed by substituting floating point
* calculations instead of integer calculations.
*
* Entry
* x1, y1, x2, y2 Coordinates of endpoints of one segment.
* x3, y3, x4, y4 Coordinates of endpoints of other segment.
*
* Exit
* x, y Coordinates of intersection point.
*
* The value returned by the function is one of:
*
* DONT_INTERSECT 0
* DO_INTERSECT 1
* COLLINEAR 2
*
* Error conditions:
*
* Depending upon the possible ranges, and particularly on 16-bit
* computers, care should be taken to protect from overflow.
*
* In the following code, 'long' values have been used for this
* purpose, instead of 'int'.
*
*/
/**************************************************************
* *
* NOTE: The following macro to determine if two numbers *
* have the same sign, is for 2's complement number *
* representation. It will need to be modified for other *
* number systems. *
* *
**************************************************************/
static int lines_intersect(int16_t x1, int16_t y1, /* First line segment */
int16_t x2, int16_t y2,
int16_t x3, int16_t y3, /* Second line segment */
int16_t x4, int16_t y4) {
int16_t b1, b2;
int32_t a1, a2, c1, c2; /* Coefficients of line eqns. */
int32_t r1, r2, r3, r4; /* 'Sign' values */
int32_t denom; /* Intermediate values */
// no apparent change in cycles regardless of which macro is used:
//#define SAME_SIGNS( a, b ) (((a)^(b)) >= 0)
#define SAME_SIGNS( a, b ) ((((a)<0) && ((b)<0)) || (((a)>=0) && ((b)>=0)))
/* Compute a1, b1, c1, where line joining points 1 and 2
* is "a1 x + b1 y + c1 = 0".
*/
a1 = y2 - y1; //debug_int32(120, -120, "A1", a1);
b1 = x1 - x2; //debug_int16(108, -120, "B1", b1);
c1 = (int32_t)x2 * (int32_t)y1 - (int32_t)x1 * (int32_t)y2; //debug_int32( 96, -120, "C1", c1);
/* Compute r3 and r4. */
r3 = ((int32_t)a1 * (int32_t)x3) + ((int32_t)b1 * (int32_t)y3) + (int32_t)c1; //debug_int32( 84, -120, "R3", r3);
r4 = ((int32_t)a1 * (int32_t)x4) + ((int32_t)b1 * (int32_t)y4) + (int32_t)c1; //debug_int32( 72, -120, "R4", r4);
/* Check signs of r3 and r4. If both point 3 and point 4 lie on
* same side of line 1, the line segments do not intersect.
*/
if ( r3 != 0 &&
r4 != 0 &&
SAME_SIGNS( r3, r4 ))
return ( DONT_INTERSECT );
/* Compute a2, b2, c2 */
a2 = y4 - y3; //debug_int32( 64, -120, "A2", a2);
b2 = x3 - x4; //debug_int16( 52, -120, "B2", b2);
c2 = (int32_t)x4 * (int32_t)y3 - (int32_t)x3 * (int32_t)y4; //debug_int32( 40, -120, "C2", c2);
/* Compute r1 and r2 */
r1 = (a2 * (int32_t)x1) + ((int32_t)b2 * (int32_t)y1) + (int32_t)c2; //debug_int32( 28, -120, "R1", r1);
r2 = (a2 * (int32_t)x2) + ((int32_t)b2 * (int32_t)y2) + (int32_t)c2; //debug_int32( 16, -120, "R2", r2);
/* Check signs of r1 and r2. If both point 1 and point 2 lie
* on same side of second line segment, the line segments do
* not intersect.
*/
if ( r1 != 0 &&
r2 != 0 &&
SAME_SIGNS( r1, r2 ))
return ( DONT_INTERSECT );
/* Line segments intersect: compute intersection point. */
denom = a1 * b2 - a2 * b1;
if ( denom == 0 )
return ( COLLINEAR );
if (
(x1 == x3 && y1 == y3) || ( x1 == x4 && y1 == y4) ||
(x2 == x3 && y2 == y3) || ( x2 == x4 && y2 == y4)
) {
// Lines touch at one end. (which is the case for every line in this puzzle!
return DONT_INTERSECT; // end-points are coincident
}
return ( DO_INTERSECT ); /* lines_intersect */
#undef SAME_SIGNS
}
#endif
static void extract_lines(graph *g) {
// for graph drawing etc it is more convenient to have all the lines in one linear array
int node, link;
max_line = 0;
for (node = 0; node < g->nodes; node++) {
// each node has between 2 and 4 arcs to other nodes
for (link = 0; link < g->node[node].links; link++) {
line[max_line].node[FROM] = node;
line[max_line].node[TO] = g->node[node].link[link];
line[max_line].intersects = 0xFFFFFFFFL; // set properly by intersection scanner
line[max_line].isCalculated = FALSE; // set to true by intersection scanner
max_line += 1; if (max_line == 127) { for (;;) ; }
}
}
}
static unsigned int compute_intersections(graph *g, lines *line) {
// precompute (N^2)/2 intersections - compare every line to every other.
// hopefully while dragging we can avoid N^2 comparisons and only update
// those pairs where one end of the line is our dragged node. However
// will do that later only if needed for speed. For now, brute force it...
int this_line, that_line;
unsigned int count;
count = 0;
// initialise all intersections to false
for (this_line = 0; this_line < max_line; this_line++) line[this_line].intersects = FALSE;
// testing a full N^2 set of comparisons to see if strange results were caused
// by mistake in optimisation, but results were the same. Just took more cycles.
for (this_line = 0; this_line < max_line-1; this_line++) {
line[this_line].isCalculated = TRUE; // set to true by intersection scanner
for (that_line = this_line+1; that_line < max_line; that_line++) {
if ((this_line != that_line) && lines_intersect(
g->node[line[this_line].node[FROM]].x, g->node[line[this_line].node[FROM]].y,
g->node[line[this_line].node[TO]].x, g->node[line[this_line].node[TO]].y,
g->node[line[that_line].node[FROM]].x, g->node[line[that_line].node[FROM]].y,
g->node[line[that_line].node[TO]].x, g->node[line[that_line].node[TO]].y
) == DO_INTERSECT) {
// when we find an intersection, mark *both* lines
line[this_line].intersects = TRUE;
line[that_line].intersects = TRUE;
count += 1; // used to determine end of game
}
}
line[this_line].isCalculated = FALSE; // set to true by intersection scanner
}
return count; // as long as there are not 256 intersections :-)
}
static void draw_graph(graph *g, int selected_node) {
int lineno;
for (lineno = 0; lineno < max_line; lineno++) {
drawline(g->node[line[lineno].node[FROM]].x, g->node[line[lineno].node[FROM]].y,
g->node[line[lineno].node[TO]].x, g->node[line[lineno].node[TO]].y,
( line[lineno].isCalculated == TRUE) ? BRIGHT :
((line[lineno].node[FROM] == selected_node || line[lineno].node[TO] == selected_node) ? BRIGHT : normal),
line[lineno].intersects != 0L);
}
}
static void assign(graph *g, const char *init) {
// take a string generated by Simon Tatham's program, representing
// a good planar graph, and convert it to a data structure
int node, i, j, links;
char *f, *s, *p;
f = s = mystrdup(init);
p = mystrchr(s, ':'); *p = '\0';
g->nodes = atoui(s); s = p+1;
node = 0; links = 0;
for (;;) {
p = mystrchr(s, '-'); *p = '\0'; i = atoui(s); s = p+1;
if (i != node) {
links = 0;
for (node = node+1; node <= i; node++) g->node[node].links = 0;
node = i;
}
p = mystrchr(s, ',');
if (p) *p = '\0';
j = atoui(s);
g->node[i].link[links] = j;
links += 1;
g->node[i].links = links;
if (p) s = p+1; else break;
}
for (i = i+1; i <= g->nodes; i++) g->node[i].links = 0;
}
static uint32_t dist(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) {
// compute and compare dist squared rather than true dist to avoid isqrt call.
// probably just adding x and y (manhattan distance) would have been good enough
uint8_t dx, dy;
uint16_t dx2, dy2;
uint32_t result;
if (x2>x1) dx = x2 - x1; else dx = x1 - x2;
if (y2>y1) dy = y2 - y1; else dy = y1 - y2;
dx2 = (uint16_t)dx*(uint16_t)dx; dy2 = (uint16_t)dy*(uint16_t)dy; // now in range 0..65535 :-(
result = (uint32_t)dx2+(uint32_t)dy2;
return result;
}
static int8_t find_nearest_node(graph *g, uint8_t x, uint8_t y) { // x,y on 0..255 space
// compare dist from cursor to every node
int node, best_node;
uint32_t dist2, best_dist = ((uint32_t) -1LL) >> 1ULL;
for (node = 0; node < g->nodes; node++) {
dist2 = dist(x,y, g->node[node].x, g->node[node].y);
if (dist2 < best_dist) {
best_dist = dist2; best_node = node;
}
}
return (best_dist < (uint32_t)MAX_CLICK_DISTANCE) ? best_node : -1;
}
#define IRQ_6809_MASK 0x10
#define ENABLE_IRQ_6809 asm("andcc #0xef")
#define DISABLE_IRQ_6809 asm("orcc #0x10")
// does not return, since we use the
// actual waitRecal "shortcut" to jump to "set_refresh" and return from there
__attribute__((noinline)) void iWaitRecal() // if inlined, the JMP -> RTS goes astray!!!
{
Vec_Loop_Count++;
// I assume EVERYTHING is done with DP = D0
// BSR DP_to_D0 ;DP to I/O
asm("jmp 0xF1A2"); // Set_Refresh
}
//int8_t longWorkEnabled = 0;
static volatile int8_t counter = 0;
static volatile int8_t counterDummy = 0;
unsigned int8_t crossings; // how many crossings are there? We only really care if 0 or non-0...
graph g;
int8_t cnode;
int8_t dragged_node;
int8_t _index;
unsigned int8_t mouse_x, mouse_y;
int8_t mouse_down, mouse_was_down;
volatile unsigned int8_t *rand = (volatile unsigned int *)0xc87b;
volatile unsigned int8_t *timer_lo = (volatile unsigned int *)0xD004;
__attribute__((interrupt)) static void gameLoop(void)
{
// for anything except the t2 timer we want to rti immediately.
if ((dp_VIA_int_flags & 0x20) == 0) return;
iWaitRecal();
*(volatile int8_t *)0xC81A = 0; // maximum analog resolution
Joy_Analog();
mouse_x = (uint8_t)(((long)Vec_Joy_1_X+128L)); // -128:127 maps to 0:255
mouse_y = (uint8_t)(((long)Vec_Joy_1_Y+128L)); // but scaled down to preserve margins
Reset0Ref(); set_scale(DRAWING_SCALE); Intensity_7F();
// draw a cursor at the joystick coordinates
Moveto_d((int)((long)mouse_y-128L), (int)((long)mouse_x-128L)); // back to screen coordinates
set_scale(CROSSHAIR_SCALE);
Moveto_d(-10,-10); Draw_Line_d(20,20); Moveto_d(-10,-10);
Moveto_d(10,-10); Draw_Line_d(-20,20); Moveto_d(10,-10);
// and back to the start again
Read_Btns();
mouse_down = ((Vec_Btn_State & 8) != 0);
Reset0Ref(); set_scale(DRAWING_SCALE); Intensity_7F(); last_intensity = -128;
if (mouse_down && !mouse_was_down) {
// this was a click
dragged_node = find_nearest_node(&g, mouse_x, mouse_y);
if (dragged_node >= 0) {
g.node[dragged_node].x = mouse_x;
g.node[dragged_node].y = mouse_y;
//compute_intersections(&g, line); // too expensive while dragging although
// visual feedback would have been nice.
// Perhaps later just compute intersections
// for the arcs exiting the dragged node (max 4)
}
} else if (mouse_down) {
// this is a continuing drag
if (dragged_node >= 0) {
g.node[dragged_node].x = mouse_x;
g.node[dragged_node].y = mouse_y;
}
} else if (mouse_was_down) { // (but is no longer...)
// end of drag - drop now.
if (dragged_node >= 0) {
// crossings = compute_intersections(&g, line); // and update display/detect completion
//longWorkEnabled = 1;
}
dragged_node = -1;
} else {
// no change, just redraw
}
mouse_was_down = mouse_down;
draw_graph(&g, dragged_node);
// if no intersections, put up a "YOU WIN!" and a time taken.
if ((crossings == 0) || ((Vec_Btn_State & 3 /* force new game? */)==3))
{
Reset0Ref(); set_scale(DRAWING_SCALE); Intensity_5F(); last_intensity = -128;
Print_Str_d(0, -20, "YOU WIN!\x80");
if (Vec_Btn_State & 1) {
// this section is cut & pasted from above. Need to make into a procedure...
// index = (int)(random()&3); // current levels 8 through 11 inclusive
_index = 3; // force level 11 for now (64 variants)
assign(&g, layout[(unsigned long)_index*64UL+((unsigned long)random8()&63UL)]); // 64 solutions per level
// Now lay the graph out as a tangle; later, a circular tangle:
// rather than compute the starting positions on the fly (and
// require sin and cos) we can just keep a pre-computed array
// of x,y for circles of 5..20 elements.
for (cnode = 0; cnode < g.nodes; cnode++) {
g.node[cnode].x = random8();
g.node[cnode].y = random8();
}
extract_lines(&g);
//longWorkEnabled = 1;
//crossings = compute_intersections(&g, line);
mouse_was_down = FALSE; mouse_down = FALSE;
}
}
dotmask = (dotmask << 1) | (dotmask>>7);
}
#define IRQBASE 0xCBF8 // this must be IRQ not FIRQ!
uint16_t volatile * const IRQ = (uint16_t *) (IRQBASE+1);
uint8_t volatile * const IRQ_INST = (uint8_t *) IRQBASE;
#define WAIT_VALUE 15
void start_graphics_thread(void (*gameLoop)(void)) {
*IRQ_INST = (unsigned int)0x7e; // JMP ... this is actually code!, first a JMP instruction
*IRQ = (unsigned long)gameLoop; // to Address
#define LITTLE_ENDIAN(a) ( (((a)>>8L)&255L) | (((a)&255L)<<8L) )
Vec_Rfrsh = (unsigned long int) (LITTLE_ENDIAN(50000UL));
// ensure timer is sensible to start with
dp_VIA_t2 = Vec_Rfrsh; // in RAM the BIOS default value of T2 = 30000 cycles
// enable T2 interrupt generation in VIA
dp_VIA_int_enable |= 0x20;
ENABLE_IRQ_6809;
}
int main(void) {
crossings = 99;
dragged_node = -1;
// unfortunately, on emulator at least, very first random is always the same
// maybe ask Malban to add some randomicity to initial hardware timer?
initRandom(rand[0],rand[1],rand[2],*timer_lo);
Vec_Joy_Mux_1_X = 1; // enable analog joystick mode
Vec_Joy_Mux_1_Y = 3;
// index = (int)(random8()&3); // current levels 8 through 11 inclusive
_index = 3; // for now forcing 11-node levels
// pick a random problem
assign(&g, layout[(unsigned long)_index*64UL+((unsigned long)random8()&63UL)]); // 64 solutions per level
// Now lay the graph out as a tangle; later, a circular tangle:
// rather than compute the starting positions on the fly (and
// require sin and cos) we can just keep a pre-computed array
// of x,y for circles of 5..20 elements.
for (cnode = 0; cnode < g.nodes; cnode++) {
g.node[cnode].x = random8();
g.node[cnode].y = random8();
}
extract_lines(&g); // speeds up various things.
//crossings = compute_intersections(&g, line); // initial state.
mouse_was_down = FALSE; mouse_down = FALSE;
start_graphics_thread(gameLoop);
for (;;) {
//if (longWorkEnabled) {
//longWorkEnabled = 0;
crossings = compute_intersections(&g, line); // and update display/detect completion
//(void)&compute_intersections;
//}
asm("CWAI #0xef"); // Wait for interrupt to happen
}
return 0;
}