4 * The geeky little puzzle game with a big noodly crunch!
6 * gPlanarity copyright (C) 2005 Monty <monty@xiph.org>
7 * Original Flash game by John Tantalo <john.tantalo@case.edu>
8 * Original game concept by Mary Radcliffe
10 * gPlanarity is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
15 * gPlanarity is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Postfish; see the file COPYING. If not, write to the
22 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
31 #include "graph_generate.h"
33 typedef struct d_vertex
{
38 typedef struct d_edge
{
43 typedef struct d_level
{
50 static d_vertex v_level1
[] = {
51 {400,30}, {143,216}, {241,518}, {559,518}, {657,216},
52 {282,138}, {210,362}, {400,500}, {590,362}, {518,138},
56 static d_edge e_level1
[] = {
57 {0,5}, {5,1}, {0,2}, {0,3}, {0,9}, {9,4}, {1,6}, {6,2},
58 {1,3}, {1,4}, {2,7}, {7,3}, {2,4}, {3,8}, {8,4},{-1,-1},
61 static d_level leveldata
[] = {
62 {1,0,v_level1
,e_level1
}
68 void generate_data(graph
*g
, int order
){
70 d_level
*l
= leveldata
+order
;
74 // scan for number of verticies
76 while(l
->v
[i
].x
!= -1)i
++;
77 vlist
=new_board(g
, i
);
78 flat
= alloca(i
*sizeof(*flat
));
80 // build graph from data
96 while(l
->e
[i
].a
!= -1){
97 add_edge(g
,flat
[l
->e
[i
].a
],flat
[l
->e
[i
].b
]);
102 g
->objective
= l
->obj
;
103 g
->objective_lessthan
= l
->less
;