Monday Apr 09, 2007

Game geeks will love it

Here is an implementation of the popular "Lines" Russian game written by Alexei Mokeev in F3. Business logic and cool graphics in less than 350 lines of code. Take a look at the snippet below to see how one leverages Java the language, and of course this runs on the JVM.

 

import f3.ui.\*;
import f3.ui.canvas.\*;
import java.lang.System;
import java.lang.Math;

 ...

operation Lines.moveBallTo (to:LinesCell) {
    var path:LinesCell\* = [to];
    while(to.marker <> 0) {
       to = getMinimumAround(to);
       insert to as first into path;
    } //OK. We have Path

    activeCell =-1;
    var frm:LinesCell = path[0];
    to = path[sizeof path -1];

    var l:Integer = sizeof path;

    if (l == 2) {
        to.ballColor = frm.ballColor;
        frm.busy = false;
        to.busy = true;
        changed = true;
        dropBalls();
        return;
    }

    // Clearing FROM
    to.ballColor = frm.ballColor;
    frm.busy = false;

    for (cell in path[indexof . <l-1]) (dur (l-2)\*100 linear) {
        cell.marker = -10; //Field in movement
    }

    for (cell in path[indexof . < l]) (dur (l-2)\*200 linear) {
        cell.marker = -1; //Stop markup
        if ((cell.x == to.x) and (cell.y == to.y)) { //Ok. We at the end
            to.busy = true;
                   
            for (c in fld[n|n.marker == -10]) { c.marker = -1;}
            changed = true;
            dropBalls();
        }
    }

}
 

Take a look at the screen shot of the game running on my Mac.

 

Friday Feb 16, 2007

"Pretty" Java

Not long ago I went to Monrovia (East of LA) to meet the Sun folks working on SOA toolability and runtimes. I gave a demo of Java Studio Creator and also learned about their work on developing a new technology. Like any presentation it's the demo that makes or breaks the deal and I was blown away by what Chris Oliver has shown that day.

The technology is called F3 - "form follows function" (the name will likely change), a declarative Java scripting language, which among other features, enables easy binding of UI element to data. Here is a link to his blog and a demo of F3 in action. F3 takes advantage of Java 2D and Swing and enables developers to rapidly develop "icandi" applications. This technology does a better job than anything else I've seen in exposing the power of Java for developing GUI applications.

There is a lot of interest around this project and perhaps if it becomes open source soon, the community will help the technology evolve to a point where is has critical mass and wide industry adoption. Having support for something like F3 in an IDE, such as NetBeans would also help. I suspect that this will happen shortly :-) Stay tuned.
 

About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today