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.
33 static char objective_string
[160];
36 int graphscore_get_raw_score(graph
*g
){
37 return (int)ceil((g
->original_intersections
- g
->active_intersections
)*
38 g
->intersection_mult
);
41 int graphscore_get_multiplier_percent(graph
*g
){
42 float obj_multiplier
= 100;
44 if(g
->objective_lessthan
)
45 if(g
->objective
> g
->active_intersections
)
46 obj_multiplier
+= 100.f
* g
->objective_mult
/ g
->objective
* (g
->objective
- g
->active_intersections
);
48 return ceil(obj_multiplier
);
51 int graphscore_get_score(graph
*g
){
52 return graphscore_get_raw_score(g
)*graphscore_get_multiplier_percent(g
)/100;
55 int graphscore_get_bonus(graph
*g
){
56 int obj_multiplier
= graphscore_get_multiplier_percent(g
);
58 if(get_timer()< g
->original_intersections
*g
->intersection_mult
)
59 return ceil ((g
->original_intersections
*g
->intersection_mult
-get_timer()) * obj_multiplier
/ 100);
64 char *graphscore_objective_string(graph
*g
){
66 return "zero intersections";
67 if(g
->objective
== 1){
68 if(g
->objective_lessthan
){
69 return "1 intersection or fewer";
71 return "1 intersection";
74 snprintf(objective_string
,160,"%d intersections%s",
75 g
->objective
,(g
->objective_lessthan
?
77 return objective_string
;