Solving Games in Java (Part I) - Practical Java Projects
4.5 (15 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,462 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Solving Games in Java (Part I) - Practical Java Projects to your Wishlist.

Add to Wishlist

Solving Games in Java (Part I) - Practical Java Projects

Java programming: using search techniques (DFS, BFS, A*, IDA*, minimax, alpha-beta pruning) in practice.
4.5 (15 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,462 students enrolled
Last updated 10/2014
Current price: $10 Original price: $30 Discount: 67% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 1 hour on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Learn to use searching techniques in practice (this part is mostly about DFS)
  • Build a solver for Boggle game (in 3 different ways)
  • Get a project prototype to work on and develop it further
View Curriculum
  • Basic Java knowledge
  • Understanding of basic data structures (array, list, queue)
  • Basic grasp of recursion
  • Read a thing or two about depth-first and breadth-first searches

You know Java basics, maybe even took a data structures course and wonder how your knowledge could be used in practice? Looking for a coding project to hone your skills? Want to outplay or baffle your friends with a program that plays better than them? Join these series to build game solvers, game AI and Flash game bot! From scratch!

Solving Games in Java course series are targeted for demonstration of practical usage of searching techniques like depth-first search, breadth-first search, A* search, IDA* search, minimax search, alpha-beta pruning. Basic understanding of recursion and Java data structures (list, array, queue) is recommended.

Course series (released as different courses, some might still be unreleased):

  • Part I: Boggle solver (3 different solutions, primary focus is DFS)
  • Part II: N-puzzle solver (4 different solutions: DFS, BFS, A*, IDA*)
  • Part III: Connect Four (4 different AI players: random, Monte Carlo, minimax, alpha-beta pruning)
  • Part IV: Diamond Dash (we will build a bot to beat this Facebook game)

By the end of each course you will build a working solution (or even multiple solutions) which you could continue to work on, update, modify, experiment!

Who is the target audience?
  • Someone who is familiar with basic algorithms and data structures
  • Java beginners who want to progress further
  • Java beginners who seek some practical projects
  • Java beginners who are eager to learn and experiment
  • Anyone else who is interested in the topics covered
Compare to Other Java Courses
Curriculum For This Course
24 Lectures
Preparing to solve
3 Lectures 09:24

Before we start working on our solvers we need a skeleton of our program to be able to handle user's input, convert that that input into game entities and prepare everything for the solver to work with

Preview 01:54

Our main entity we are going to work with is a board. We need to represent it in a convenient way so that it doesn't bring us any problems in the future.

Preview 03:20

We want our user to supply a board in a very simple way to make his life easier. And this input has to be converted to our board representation so we can work with it in all future episodes.

Building Boggle board from input

Solver basics and user's input
3 questions
DFS Solver
6 Lectures 17:43

We are going to have a look at abstract code which will explain how our first solution is going to work using depth-first search. A very nice step by step example will make it easier to grasp the contents if you have problems understanding the abstract code.

DFS approach

In order to make decisions whether the given word is valid or not we need to check if it is contained in the dictionary. There are many different dictionaries out there. We have some constraints on the dictionary and therefore provide a way of getting a dictionary that requires almost no work to clean it up so that it fits for our purposes.

Getting a dictionary file

Every single solver will need the ability to read a dictionary and get the list of words from it. We are going to build an abstract class which will provide a method for our solvers to use to get the dictionary words easily.

Preview 01:42

Before solving the game we need to set everything up: read the dictionary file, setup all the variables which are going to be needed during the search, declare the method we are going to use as a core search method.

Solver skeleton

We are going to build a core of our depth-first solver which is going to generate all possible words which can be found on the given board.

Generating all possible words on given board

We are going to execute our first solver to see how it performs. We are going to verify it using a real game.

Solver in action

DFS solver basics
3 questions
Dictionary Solver
4 Lectures 09:46

Another solution is going to be presented to show you how we can approach the same problem from a different angle.

Dictionary approach

Once again we are going to build the infrastructure of our solver to set everything up that is needed for our new solver to function well.

Solver skeleton

The core of our second solver that is going to go over the whole dictionary and try finding each word on the board.

Searching for all possible words on given board

It is time to execute our second solver and compare the results with the first one.

Preview 02:00

Dictionary solver basics
2 questions
DFS Solver using Trie
7 Lectures 20:53

We are going to point out the problems with the first solver and propose another solution that is going to be based on our first solver but will try to fix its bottlenecks.

DFS approach revisited

For our third solver we are going to use a data structure named Trie. This episode contains all the information you need to understand how it works, how it is built, how it is queried for the information that we need.

Introducing Trie

We start building our Trie data structure. The overall functionality is described via methods we need.

Trie skeleton

We are going to fill in the gaps in our Trie data structure to make it work in a way that we require it to.

Constructing Trie

For the final time we are going to set everything up for our last solver. We need to prepare our Trie data structure before we start using it.

Solver skeleton

The core of our final solver that is going to be based on the first solver but will add extra pruning which will help us to avoid generation of many useless words (which are not valid)

Generating all possible words on given board using Trie

It is time to compare our final solver with the others. We are going to run it against the real game and then try to find a limit at which it works very well.

Solver in action

DFS solver using Trie basics
2 questions
Final words
1 Lecture 00:53
Where to go from here
About the Instructor
Konstantin Saveljev
4.5 Average rating
15 Reviews
1,462 Students
1 Course
Software Developer

I have been dealing with software development since 2001. I am currently in pursuit of Master's Degree in Computer Science. For most of the projects at work I have been working with Java and Scala. In my free time I like to work on small projects in different languages which include Ruby, JavaScript, C/C++, Haskell.

During my first year at the university I became interested in learning algorithms and competing in different contests which required algorithms knowledge. Since then I have participated twice in ACM ICPC as a part of our university team. I'm constantly solving problems on UVa online judge having nearly 1000 problems solved. Algorithms can be very interesting when presented in the right way. Games are definitely one of those right ways to show those eager to learn how something works to solve a game or play against human at good level.