Re: Scores in Gnome mines.



Timo Sirainen wrote:
> 
> On Thu, 21 May 1998, Bruno Widmann wrote:
> 
> > >   files named gnomine.10x10x1.scores or something like this. Is it
> > > possible to have
> > >   just one file for scores in custom mode and record the height, width
> > > and number of
> > >   mines in the score file instead, or should we just forget about scores
> > > in this mode?
> > >
> >
> > yep, store that, and do the ranking after some formula, like
> >
> >              width*height (of Minefield)
> > Ranking =   ----------------------------
> >               time-needed to clear it
> 
> What about number of mines? I don't think there's any good way to make
> score list in custom mode..
> 
I've been trying to do something about this. I'll attach the patch.

This is not tested very much but it may be a starting point for someone
with more
programming knowledge than me. 

Don't shoot if this is totally off target. ;-)

Cheers
Kjartan
--- Makefile.am	Fri May 22 16:00:15 1998
+++ Makefile.am.new	Thu May 21 21:38:09 1998
@@ -26,7 +26,16 @@
 
 install-data-local:
 	-$(mkinstalldirs) $(scoredir)
-	-touch $(scoredir)/gnomine.scores
-	-chown games.games $(scoredir)/gnomine.scores
-	-chmod 664 $(scoredir)/gnomine.scores
+	-touch $(scoredir)/gnomine.Tiny.scores
+	-chown games.games $(scoredir)/gnomine.Tiny.scores
+	-chmod 664 $(scoredir)/gnomine.Tiny.scores	
+	-touch $(scoredir)/gnomine.Medium.scores
+	-chown games.games $(scoredir)/gnomine.Medium.scores
+	-chmod 664 $(scoredir)/gnomine.Medium.scores	
+	-touch $(scoredir)/gnomine.Biiiig.scores
+	-chown games.games $(scoredir)/gnomine.Biiiig.scores
+	-chmod 664 $(scoredir)/gnomine.Biiiig.scores	
+	-touch $(scoredir)/gnomine.Custom.scores
+	-chown games.games $(scoredir)/gnomine.Custom.scores
+	-chmod 664 $(scoredir)/gnomine.Custom.scores	
 	-chgrp games $(bindir)/gnomine && chmod 2111 $(bindir)/gnomine
--- gnomine.c.old	Thu May 21 21:54:52 1998
+++ gnomine.c	Fri May 22 15:56:47 1998
@@ -69,6 +69,7 @@
 	N_("Tiny"),
 	N_("Medium"),
 	N_("Biiiig"),
+	N_("Custom"),
 };
 
 void show_face(GtkWidget *pm)
@@ -113,10 +114,8 @@
 {
 	gchar buf[64];
 
-	if(fsize<3)
+	if(fsize<4)
 		strncpy(buf, fsize2names[fsize], sizeof(buf));
-	else
-		g_snprintf(buf, sizeof(buf), "%dx%dx%d",xsize,ysize,nmines);
 
 	show_scores(buf, 0);
 }
@@ -160,13 +159,19 @@
         show_face(pm_win);
         gtk_clock_stop(GTK_CLOCK(clk));
 
-	score = (gfloat) (GTK_CLOCK(clk)->stopped / 60) + 
-		(gfloat) (GTK_CLOCK(clk)->stopped % 60) / 100; 
-
-	if(fsize<3)
-		strncpy(buf, fsize2names[fsize], sizeof(buf));
-	else
-		g_snprintf(buf, sizeof(buf), "%dx%dx%d",xsize,ysize,nmines);
+	if(fsize<3) {
+	    score = (gfloat) (GTK_CLOCK(clk)->stopped / 60) + 
+		    (gfloat) (GTK_CLOCK(clk)->stopped % 60) / 100;
+	} else {
+
+	    if(fsize==3) {
+	    score = ((xsize * ysize) / (nmines * 10) ) *
+		    ((gfloat) (GTK_CLOCK(clk)->stopped / 60) +
+		    (gfloat) (GTK_CLOCK(clk)->stopped % 60) / 100);
+	    }
+	}
+	
+	strncpy(buf, fsize2names[fsize], sizeof(buf));
 
 	pos = gnome_score_log(score, buf, FALSE);
 	show_scores(buf, pos);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]