seed r19 - trunk/examples



Author: racarr
Date: Thu Oct 23 10:36:38 2008
New Revision: 19
URL: http://svn.gnome.org/viewvc/seed?rev=19&view=rev

Log:
Symmetry.


Modified:
   trunk/examples/lightsoff.js

Modified: trunk/examples/lightsoff.js
==============================================================================
--- trunk/examples/lightsoff.js	(original)
+++ trunk/examples/lightsoff.js	Thu Oct 23 10:36:38 2008
@@ -74,14 +74,32 @@
 function random_clicks()
 {
 	var count = Math.round(20 * Math.random());
-	for ( q = 0; q < count; ++q)
+
+	var sym = Math.floor(3*Math.random());
+
+	for ( q = 0; q < count+5; ++q)
 	{
-		i = Math.round(4 * Math.random());
-		j = Math.round(4 * Math.random());
-		do_click(i, j);
+
+	  	    
+	    i = Math.round(4 * Math.random());
+	    j = Math.round(4 * Math.random());
+	    do_click(i, j);
+	    if (sym == 0)
+	    {
+		    do_click(Math.abs(i-4), j);
+	    }
+	    else if (sym ==1)
+	    {
+		    do_click(Math.abs(i-4), Math.abs(j-4));
+	    }
+	    else
+	    {
+		    do_click(i,Math.abs(j-4));
+	    }
+	    
 	}
 	//do it again if you won already
-	if ( wincount == size * size)
+	if ( wincount == 0)
 		random_clicks();
 }
 



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