Commits

Shlomi Fish committed 2da45f5

Correct URL.

Comments (0)

Files changed (4)

abc-path/Games-ABC_Path-Solver/Build.PL

     {
         resources =>
         {
-            repository => "http://svn.berlios.de/svnroot/repos/fc-solve/abc-path/",
+            repository => "http://bitbucket.org/shlomif/abc-path",
             homepage => "http://www.shlomifish.org/open-source/projects/japanese-puzzle-games/abc-path/",
         },
         keywords =>

abc-path/js/abc-path-test.html

 <link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
 <script type="text/javascript" src="qunit.js"></script>
 <script type="text/javascript" src="joose.mini.js"></script>
+<script type="text/javascript" src="ms-rand.js"></script>
 <script type="text/javascript" src="abc-path.js"></script>
 <script type="text/javascript" src="abc-path-test.js"></script>
 

abc-path/js/abc-path.js

         },
     },
 });
-Class('ABC_Path.MicrosoftRand', {
-    has: {
-        seed: { is: rw, },
-    },
-    methods: {
-        rand: function() {
-            this.setSeed((this.getSeed() * 214013 + 2531011) & 0x7FFFFFFF);
-            return ((this.getSeed() >> 16) & 0x7fff);
-        },
-        max_rand: function(mymax) {
-            return this.rand() % mymax;
-        },
-        shuffle: function(deck) {
-            if (deck.length) {
-                var i = deck.length;
-                while (--i) {
-                    var j = this.max_rand(i+1);
-                    var tmp = deck[i];
-                    deck[i] = deck[j];
-                    deck[j] = tmp;
-                }
-            }
-            return deck;
-        },
-    },
-});
 Class('ABC_Path.Generator', {
 });
 Class('ABC_Path.Generator.FinalLayoutObj', {
     has: {
         seed: { is: rw },
         rand: { is: rw, init: function () {
-            return new ABC_Path.MicrosoftRand({ seed : this.seed });
+            return new MSRand({ seed : this.seed });
         }
         },
         _get_next_cells_lookup: { is: ro, init: function() {

abc-path/js/ms-rand.js

+"use strict";
+/*
+ * Microsoft C Run-time-Library-compatible Random Number Generator
+ * Copyright by Shlomi Fish, 2011.
+ * Released under the MIT/X11 License
+ * ( http://en.wikipedia.org/wiki/MIT_License ).
+ * */
+Class('MSRand', {
+    has: {
+        seed: { is: rw, },
+    },
+    methods: {
+        rand: function() {
+            this.setSeed((this.getSeed() * 214013 + 2531011) & 0x7FFFFFFF);
+            return ((this.getSeed() >> 16) & 0x7fff);
+        },
+        max_rand: function(mymax) {
+            return this.rand() % mymax;
+        },
+        shuffle: function(deck) {
+            if (deck.length) {
+                var i = deck.length;
+                while (--i) {
+                    var j = this.max_rand(i+1);
+                    var tmp = deck[i];
+                    deck[i] = deck[j];
+                    deck[j] = tmp;
+                }
+            }
+            return deck;
+        },
+    },
+});