1.1 --- a/rt/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java Sun May 11 23:06:45 2014 +0200
1.2 +++ b/rt/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java Mon May 26 14:33:11 2014 +0200
1.3 @@ -107,4 +107,19 @@
1.4
1.5 @JavaScriptBody(args = { "o" }, body = "return o.valueOf();")
1.6 private static native boolean bvalueOf(Object o);
1.7 +
1.8 + public static int around(Object model, int x, int y) {
1.9 + return minesAt(model, x - 1, y - 1)
1.10 + + minesAt(model, x - 1, y)
1.11 + + minesAt(model, x - 1, y + 1)
1.12 + + minesAt(model, x, y - 1)
1.13 + + minesAt(model, x, y + 1)
1.14 + + minesAt(model, x + 1, y - 1)
1.15 + + minesAt(model, x + 1, y)
1.16 + + minesAt(model, x + 1, y + 1);
1.17 + }
1.18 +
1.19 + private static int minesAt(Object model, int x, int y) {
1.20 + return x + y;
1.21 + }
1.22 }