Skip to main content

Games People Play

Posted by editor on November 29, 2005 at 7:24 AM PST

Playing Sudoku and Quake 2 with Java

I usually don't have time do the daily Sudoku in the newspaper, but it's a smart diversion for when the opportunity presents itself, and something I've blogged about before -- the Sept 15 Editor's Daily Blog linked to Phil Milne's Swing-based Su Doku workpad and evaluator.

So, you can play Sudoku in Java, but how about solving it? Any Java developer could probably whip up a brute-force search of the problem space, but this is badly inefficient, to put it nicely. Ideally, you should be able to express the inherent concept of Sudoku -- that every row, line, and region must contain the numbers 1-9 with no duplicates -- and let the computer efficiently work within those constraints.

As it turns out, Sudoku is a fine way to teach the concepts of "constraint programming", as illustrated by
today's Feature Article, Solving Sudokus in Java, in which Yan Georget applies the Koalog Constraint Solver, a Java constraint programming library, to solve the puzzle and show how constraint programming works:

CP differs from naive enumeration methods by the fact that constraints contain powerful filtering algorithms (usually inspired by Operational Research techniques) that will drastically reduce the search space by dynamically reducing the domains of the variables during the enumeration phase (also known as the "search phase").

Hopefully, you'll find the ideas of constraint programming flexible enough to apply them to other problems you might need to solve.

Speaking of using Java for gaming,

Jake2, the Java port of the GPL'ed Quake 2 game engine, recently got "slashdotted", with the popular technology site noting that Jake2's Java Web Start page allows you to download, configure, and launch the game from your browser. Web-Start-ing allows you to choose (and evaluate) two versions of the game, one using JOGL for its graphics, the other using LWJGL.

Also in Projects and
, the Java Web Services and XML Community page is spotlighting Lorna Stafford's blog entry on the advantages and disadvantages of XBRL, "an XML-based language which allows business information to be electronically communicated more easily than through other available formats." More information about the language is available on the XBRL home page.

In Also in
Java Today

Alexander Libman and Vladimir Gilbourd's Comparing Two High-Performance I/O Design Patterns "investigates and compares different design patterns of high performance TCP-based servers. In addition to existing approaches, it proposes a scalable single-codebase, multi-platform solution (with code examples) and describes its fine-tuning on different platforms. It also compares performance of Java, C# and C++ implementations of proposed and existing solutions."

Stephane Bailliez's blog entry ClassLoaders in JEE 5 Specifications takes the Java EE 5 spec to task over the potential hazards and side-effects of its classloading model: "I have been reading the proposed final draft of the Java Platform Enterprise Edition 5 Specification (aka JSR 244) and noticed again that nothing has changed in the classloading area (OK, I did not send any feedback to the JSR group, so I'm guilty too). It is as vague as it has always been and do not impose anything which would clearly protect the deployed applications from server implementation libraries, otherwise known as class leaking."

Kirill Grouchnikov offers a Proposal for uniform support of third-party components in custom look-and-feels in today's Weblogs: "This posting proposes an approach for uniform support of third-party components in custom look-and-feels. The approach has been successfully adopted in Liquid and Substance look-and-feels."

Façade, gaming redefined, Romain Guy writes:
"Every now and then, a group of few people come up with a bright idea that shakes the world of video games. Façade might just be one of them, and it's Java powered."

"Huh? I got a patent? Say what?" David Herron explains how his Jini-based testing system won a patent in
A patent for the Java Quality organization

In today's Forums,
ludo explains a GlassFish gotcha in
Re: How can I debug @EJB annotation failure in JSF managed bean?:
"Yes, the netbeans source sample is not good any more with b28: the application.xml has xsi:schemaLocation="" instead of xsi:schemaLocation="". See the little diff between j2ee and javaee!! Might be the reason? Now, I still believe that deployment backend should warn the user about old style J2EE apps, using annotations that these annotations will not be processed at deployment time... There is nothing worse than a silent NPE at run time. We'll fix the sample code."

"Beyond Java" author Bruce Tate replies in the Book Club thread
Re: Chapter 4: Glass Breaking to clarify the book's purpose:
"I don't annoint a winner in the book. I pick Ruby to talk about because I didn't want this book to be a dissertation on language. I wanted the book to be about Java, and to be a wake up call to the community. I could have used such a book, but none existed. it's the dynamic language with a catalyst, and that makes it slightly more interesting than the alternatives. I personally think we're solving too many small problems with Java. A cleaner, simpler alternative would be better."

In today's
News Headlines

Registered users can submit news items for the href=""> News Page using our
news submission
. All submissions go through an editorial review before being
posted to the site. You can also subscribe to the href=""> News RSS

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

Playing Sudoku and Quake 2 with Java