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.
34 static char objective_string
[160];
37 int graphscore_get_raw_score(graph
*g
){
38 return (int)ceil((g
->original_intersections
- g
->active_intersections
)*
39 g
->intersection_mult
);
42 int graphscore_get_multiplier_percent(graph
*g
){
43 float obj_multiplier
= 100;
45 if(g
->objective_lessthan
)
46 if(g
->objective
> g
->active_intersections
)
47 obj_multiplier
+= 100.f
* g
->objective_mult
/ g
->objective
* (g
->objective
- g
->active_intersections
);
49 return ceil(obj_multiplier
);
52 int graphscore_get_score(graph
*g
){
53 return graphscore_get_raw_score(g
)*graphscore_get_multiplier_percent(g
)/100;
56 int graphscore_get_bonus(graph
*g
){
57 int obj_multiplier
= graphscore_get_multiplier_percent(g
);
59 if(get_timer()< g
->original_intersections
*g
->intersection_mult
)
60 return ceil ((g
->original_intersections
*g
->intersection_mult
-get_timer()) * obj_multiplier
/ 100);
65 char *graphscore_objective_string(graph
*g
){
67 return _("zero intersections");
68 if(g
->objective
== 1){
69 if(g
->objective_lessthan
){
70 return _("1 intersection or fewer");
72 return _("1 intersection");
75 snprintf(objective_string
,160,_("%d intersections%s"),
76 g
->objective
,(g
->objective_lessthan
?
78 return objective_string
;