[aisleriot] guile: Rename "random" function



commit 693d4bc80cfc097287aa36bf493fa617a904d234
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 30 13:56:13 2011 +0100

    guile: Rename "random" function
    
    Rename "random" function to "aisleriot-random" since it clashes with
    a guile builtin function.

 games/clock.scm       |    2 +-
 games/gay_gordons.scm |    4 ++--
 games/sol.scm         |    2 +-
 src/game.c            |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/games/clock.scm b/games/clock.scm
index fdd7bf0..69b9ee5 100644
--- a/games/clock.scm
+++ b/games/clock.scm
@@ -191,7 +191,7 @@
 	       (_"When without a stapler, a staple and a ruler will work")
                ; Translators: This is one of the sentences that are used when the user wants to get a hint. Since the 'clock' game is a joke in itself, the sentence it nonsensical and/or a joke. So you can substitute anything you like here; you don't have to translate the original sentence!
 	       (_"Never blow in a dog's ear"))
-	 (random 12))))
+	 (aisleriot-random 12))))
 
 (define (get-options) #f)
 
diff --git a/games/gay_gordons.scm b/games/gay_gordons.scm
index 4809681..1588fde 100644
--- a/games/gay_gordons.scm
+++ b/games/gay_gordons.scm
@@ -87,7 +87,7 @@
         (deepest (apply max holes))
         (total (apply + holes))
         (n (apply + (map (lambda (x) (if (= (car x) 0) 0 1)) slots)))
-        (r (random n)))
+        (r (aisleriot-random n)))
     (if (<= total (* deepest 2)) ; Catch the case where we are forced to
                                 ; fill in a hole
        (find-deepest holes deepest)
@@ -95,7 +95,7 @@
 
 (define (select-second slots first)
   (let* ((n (apply + (map (lambda (x) (if (= (car x) 0) 0 1)) slots)))
-        (r (random (- n 1))))
+        (r (aisleriot-random (- n 1))))
     (find-hole slots r first)))
 
 ; Accepts a source slot and a list of count, slot-id pairs and distributes
diff --git a/games/sol.scm b/games/sol.scm
index e49d84a..9268939 100644
--- a/games/sol.scm
+++ b/games/sol.scm
@@ -584,7 +584,7 @@
 (define (shuffle-deck-helper deck result ref1 len)
   (if (zero? len)
       result
-      (let* ((ref2 (+ ref1 (random len)))
+      (let* ((ref2 (+ ref1 (aisleriot-random len)))
 	     (val-at-ref2 (vector-ref deck ref2)))
 	(vector-set! deck ref2 (vector-ref deck ref1))
 	(shuffle-deck-helper deck (cons val-at-ref2 result) (+ ref1 1) (- len 1)))))
diff --git a/src/game.c b/src/game.c
index 390a88e..128566d 100644
--- a/src/game.c
+++ b/src/game.c
@@ -1068,7 +1068,7 @@ cscm_init (void)
   scm_c_define_gsubr ("set-slot-x-expansion!", 2, 0, 0,
                       scm_set_slot_x_expansion);
   scm_c_define_gsubr ("set-lambda", 8, 0, 1, scm_set_lambda);
-  scm_c_define_gsubr ("random", 1, 0, 0, scm_myrandom);
+  scm_c_define_gsubr ("aisleriot-random", 1, 0, 0, scm_myrandom);
   scm_c_define_gsubr ("click-to-move?", 0, 0, 0, scm_click_to_move_p);
   scm_c_define_gsubr ("get-score", 0, 0, 0, scm_get_score);
   scm_c_define_gsubr ("set-score!", 1, 0, 0, scm_set_score);



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