sondosaabed / Optimal-coins-game-strategy

a java project that uses dynamic programming to implemnt the Optimal coins collecting game strategy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimal coins game strategy:

This project was created as part of Algorithm analysis course. A java project that uses dynamic programming to implemnt the Optimal game strategy of coins.

Problem Description

This is a two-player game. There are even number of coins arranged in a row. There will be alternate turns. In each turn, a player can either select the first coin in the row or the last coin in the row and keep it with him. The objective of the problem is to determine the maximum possible amount of money a player can definitely win, if he moves first.

In this problem, we will try to collect maximum amount without underestimating the opponent. We can choose either the first or the last coin in the row. We will pick the one which results in giving us lesser amount to ensure that we can definitely win this much of amount irrespective of opponent’s moves.

Input and Output

Coins [] = 4, 15, 7, 3, 8, 9

Expected result= 27

The input.txt file is an example of the input file.

App screenshots:

Main: 1

Browse file or input using the textbox: 2

The main after running the program: 3

The dynamic table filled using bottom up approach: 4

A simualtion of the game in which player 1 gets the optimal solution: 5

About

a java project that uses dynamic programming to implemnt the Optimal coins collecting game strategy

License:MIT License


Languages

Language:Java 100.0%