Implementing Minimax Algorithm in Java

If you want to write a program that is able to play a strategy game, there are good chances that you will be looking at a Minimax algorithm. This is especially true when it comes to games like chess, where variations of the Minimax algorithm are what is used to build the strongest chess-playing programs in existence. In this article, I will look at implementing the basic version of the Minimax algorithm with Java. Continue reading “Implementing Minimax Algorithm in Java”

Please, stop writing so many “for loops” in Java!

In this blog post, I want to take you back to basics and talk about Java for loops. To be honest, I am writing this blog post partially for myself, as this is something that I am myself too often guilty of. Since Java 8, we don’t have to write so many for loops in Java! I hope this blog post will make your code nicer to read and quicker to write. Continue reading “Please, stop writing so many “for loops” in Java!”

Simulating the Secretary Problem with Java

You might have noticed that I like reading books. I have recently read “Algorithms to Live By: The Computer Science of Human Decisions” which absolutely fascinated me! The book mentions a famous optimal stopping (Wikipedia) problem called Secretary Problem. In this blog post I will explain it and then we will have some fun simulating it with Java. Let’s see if we can find a solution by brute force! Continue reading “Simulating the Secretary Problem with Java”