home

About Me

Portfolio

Categories

Archive

Links

Comments

Category: Java

Three in a row!

056.jpg
Such an old-fasioned game!

Just a simple demo. The goal was to minimize the upper bound of needed checks along the tic-tac-toe gameboard.

Brief Explanation

The result was achieved by assuming that the elements of the 3x3 matrix could be mapped to the [1,9] interval in N by the bijective application (from [1,3]x[1,3] to [1,9]):

f(i,j)=i+3(j-1);

Now let n=f(i,j), for each i,j in [1,3].

  • If n is 5, there are 4 checks needed (the middle row, the middle column, both diagonals);
  • If n is any other odd number (1,3,7,9), it stays in the corner, so ther are only 3 checks needed (a row, a column, a diagonal);
  • For even numbers the upper bound decreases to 2 (a row and a column only).

So the number of needed controls stays between 2 and 4, in a maximum range of 8 (3 rows, 3 columns, 2 diagonals) - it would be nice if tic-tac-toe was not a complete game in which neither player can win...:P

Here it goes the code and the link to the main article.

Curve Mozzafiato

051.jpg 052.jpg 053.jpg 054.jpg 055.jpg

Su suggerimento di Andrea, ho scritto due righe che permettessero di disegnare curve piane parametriche, e questi sono i risultati =P

Appena ho un momento preparo un'applet in modo che tutti possiate vedere come dispongo inutilmente del mio tempo ^____^

________________________________________________________________________-

 

After a brief talk with Andrea, I've written a couple of code lines able to draw plain parametric curves, and these are the results.

As soon as I get a minute, I will export an applet so you can all see how well do I waste my time :P

Some cool Java graphic demos

Here there are some stuff I made as a contest for students of our java course: