Battleships Java Demo Client Quick Start Guide

In order to run this project you first have to set up java on your machine. Then you would need to install an integrated development environment on your system. We have used Eclipse, but any such IDE would do.

Setting up Java

In order to set up Eclipse, you first have to install the Java Development Kit (JDK). To run all Eclipse 4.7 (Oxygen) packages you will need JDK version 8, which can be downloaded from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html . You can simply download the package corresponding to your system and follow the instructions on the website to install it.

Linux users may wish to follow this guide https://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html .

Installing Eclipse

Then you can download and install Eclipse Oxygen from https://www.eclipse.org/downloads/ . Click "Download" and follow the instructions to complete the installation. When prompted you want to select Eclipse IDE for Java Developers

Importing the Project

The simplest way to import the project is to download the zip file to your computer from here , unzip the file, run Eclipse and then go to File -> Import -> General and select Existing Projects into Workspace. Then navigate to the directory where the unzipped files are and select it.

Running the Demo Client

Open the Package Explorer and navigate to src/battleships/MainWindow.java. Double click on MainWindow.java. You can run the project by pressing Ctrl+F11. This should start the client's form where you can use your bot's details to login and start playing.

Adding Logic to Your Bot

In order to define your own logic, you have to open the Battleships class. Once you open it, you will find a method called calculateMove. There you define where you want to place your ships and where on your opponents board you want to fire.

Final Remarks

Hopefully now you're in place to get picking through the demo code. This should help you figure out how the API works, and ultimately starting work on your army of intelligent bots! We look forward to seeing what you build!

iconBattleshipsBlack.png
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License