Posts

Showing posts with the label Logic Games

TicTacToe Games - Featuring Java

Hi Learners, at this occasion   I wanna share about application for 'Tictactwo games', fo Indonesian it's also called "Catur Jawa'. this game was built in Java faturing Netbean 8.2. This program is made from 3 rows X 3 columns. This program also used AWT ans SWING to make the application GUIable. I just wanna share a bit about the matriks using Array of 2 dimention. see the code bellow ({{ 0, 1, 2 }, { 3, 4, 5 },{ 6, 7, 8 },{ 0, 3, 6 },{ 1, 4, 7 }, { 2, 5, 8 },{ 0, 4, 8 }, { 2, 4, 6 }}). It means that the program will launch winning for the one who can make three rows directly (vertical, horizontal or diagonal based on the path that described from the Algortihm Given, We just use Greedy Algorithm for the two playyers (without computer's player for the code). Have a nice codding :). import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TicTac2 implements ActionListener {     private int[][] winCombinations = new int[][] { { 0, 1, 2...