In one last tutorial we show a print of Tic Tac Toe in Java, in a text mode and Human x Human, as well as the code of 6 classes needed to run the program:
Tic Tac Toe in Java
Now let's review, in detail, each class, method and idea we use to create the game.
Showing posts with label Games. Show all posts
Showing posts with label Games. Show all posts
How to make a Tic Tac Toe (noughts and crosses) game in Java
It's time to put our knowledge into practice to do something really cool and useful:The Tic Tac Toe game in Java! Also known as noughts and crosses!
This is a simple version, to be played with two people. Note that in a simple Java application like this, the result came out around 300 lines of code.
If you are Java programmer, click to see the full commented code and explanation about the Tic Tac Toe Java Game creation.
Yes, there is a strategy we can adopt (or the computer may adopt) to never lose a game of tic tac toe:
http://en.wikipedia.org/wiki/Tic-tac-toe
Game: Guess the number raffled by the computer
Play a game is very good and fun... but playing a game that you have created, is a pleasure that just a few have.The Java programming language is known to be widely used for creating games. Most likely you've played a game, even online ones, are done in Java.
Based on the knowledge gained in our online course of Java, it is possible to create a game.
Although very simple, it is quite genious and cool.
The computer will randomly select a number between 1 and 1000 and you have to guess what number this is.
Each round you enter a number and the computer will give you the tips, saying the number you typed is greater or less than the number it choose.
Ends when you hit, and he keeps the number of attempts you made. Can you beat your own record?
You know what's the best strategy?
Marcadores:
Classes,
Flux Control,
Games,
Methods,
Statements
Commented and explained code of Minesweeper game in Java
We will now explain in detail how to do, and understand all program logic of a minesweeper game in the Java programming language.
The game code is on our last article of our online course Java:
Game: How to make a Minesweeper in Java
Marcadores:
Apps,
Data Structure,
Games,
Methods,
Object Oriented,
Statements
Game: How to make a Minesweeper in Java
Continuing the games we're doing, and teaching how to do, now we'll show you how to program the famous Minesweeper game in Java.
If you did not follow the other game made in our Java course, see:
How to make the game Battleship in Java
Here we show the classes and game code, in the next article we will explain in detail how to program the game:
Commented and explained code of Minesweeper game in Java
Marcadores:
Apps,
Games,
Methods,
Object Oriented
Battleship game in Java: How to program
Now, that we already learned how to pass arrays (of any size) for methods, we can do something more useful. Let's do the famous game called naval battle, in text mode.
We use everything we have learned so far in our Java course: if else, while loop, loop, methods, random numbers, arrays, multidimensional arrays and creativity.
Marcadores:
Apps,
Array and ArrayList,
Data Structure,
Flux Control,
Games,
Methods,
Statements
Subscribe to:
Posts (Atom)
