Course:CPSC312-2017-Risk AI

From UBC Wiki

Title

Authors: Sheldon, Mah-dir

What is the problem?

For the project we plan to implement the game Risk in Prolog. The rules can be found at Risk (game). The game will be played through the command line.

What is the something extra?

Creating an AI for the game that plays alongside the player. The AI will be able predict future moves from the real player and decide how to attack/defend/move resources around the map in order to win.

What did we learn from doing this?

Prolog is really good at describing relations and remembering rules throughout the game. However for games like Risk where the game tree complexity can reach up to 10 ^ 5945 it would be impossible to search every single possible move the player could make. Instead we decided to make the AI respond directly from the actions the player takes within the game. The game itself becomes very complex with all the decisions that are possible (attacking multiple times, moving armies, distributing armies etc.) so creating the AI this way makes the decisions more simpler and faster to process. This approach is a lot more interesting because we can tell the computer to play the game using different styles (offensive/defensive) instead of looking through all the possible moves available.

All in all, we think that logic programming is suitable for games that have many relations and rules. However, combinations of repeat, backtracking, pattern matching, and failures to maintain a running loop for the game can easily be misused and are not as straight forward as their imperative counterparts. We would definitely recommend logic programming for prototyping, but perhaps not for maintainable, production-ready project.

https://github.com/sheldonlai/logic-programming-proj