[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gzz/modules/pp PPDemo.java
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gzz/modules/pp PPDemo.java |
Date: |
Tue, 28 Jan 2003 01:31:31 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 03/01/28 01:31:31
Modified files:
gzz/modules/pp : PPDemo.java
Log message:
added zooming.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPDemo.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/gzz/modules/pp/PPDemo.java
diff -u gzz/gzz/modules/pp/PPDemo.java:1.2 gzz/gzz/modules/pp/PPDemo.java:1.3
--- gzz/gzz/modules/pp/PPDemo.java:1.2 Mon Jan 27 11:14:52 2003
+++ gzz/gzz/modules/pp/PPDemo.java Tue Jan 28 01:31:31 2003
@@ -38,7 +38,7 @@
* So let's talk about it like demo or robustness test.
*/
public class PPDemo implements ActionListener {
- public static final String rcsid = "$Id: PPDemo.java,v 1.2 2003/01/27
16:14:52 mudyc Exp $";
+ public static final String rcsid = "$Id: PPDemo.java,v 1.3 2003/01/28
06:31:31 mudyc Exp $";
private static boolean dbg = false;
private void pa(String s) { System.out.println(s); }
@@ -61,18 +61,31 @@
if (dbg) pa("In Cell: "+c);
start = c.h(d.clone);
+
+ Random r = new Random();
+ int rand = r.nextInt(100);
// if just cam to paper - jump to different note
if (justCameToPaper) {
ppv.clearInterps();
if (dbg) pa("Just came to paper..");
- if (c.s(d.contains, 1) != null) {
- if (dbg) pa(" Go rigth");
- c = randomMoves(d.contains, 1);
- } else if (c.s(d.contains, -1) != null) {
- if (dbg) pa(" Go left");
- c = randomMoves(d.contains, -1);
+ if (rand<50) {
+ if (c.s(d.contains, 1) != null)
+ c = randomMoves(d.contains, 1);
+ else if (c.s(d.contains, -1) != null &&
+ c.s(d.contains, -1) != c.h(d.contains))
+ c = randomMoves(d.contains, -1);
} else {
+ if (c.s(d.contains, -1) != null &&
+ c.s(d.contains, -1) != c.h(d.contains))
+ {
+ c = randomMoves(d.contains, -1);
+ }
+ else if (c.s(d.contains, 1) != null)
+ c = randomMoves(d.contains, 1);
+ }
+
+ if (c.h(d.clone) == start) {
// only one note and that is link.. we go back..
if (c.h(d.clone).s(d.clone) != null) {
@@ -102,6 +115,16 @@
justCameToPaper = true;
}
+ if (0 <= rand && rand <= 24)
+ ppv.zoom = 1;
+ else if (25 <= rand && rand <= 49)
+ ppv.zoom = 0.8f;
+ else if (50 <= rand && rand <= 74)
+ ppv.zoom = 1.7f;
+ else ppv.zoom = 0.56f;
+
+ if (dbg) pa("zoom: "+ppv.zoom);
+
if (dbg) pa("To Cell: "+c);
c = c.h(d.clone);
avc.setCursorOffset(0);
@@ -117,6 +140,10 @@
for (; c != null; c = c.s(d, dir)) jumps++;
if (jumps == 0) return null;
+
+ // we don't want to go to the paper..
+ if ( dir < 0) jumps--;
+
Random r = new Random();
int go = 1 + r.nextInt(jumps-1);