Algorithms based on Game Theory

Find out the correct position of the ball after shuffling

Consider a shuffle game. There are 3 glasses numbered from 1 to 3 and one ball is hidden under any one of the glass. Then… Read More »

Optimal Strategy for a Game | Set 3

Consider a row of n coins of values v1 . . . vn, where n is even. We play a game against an opponent by… Read More »

Find the winner of the Game to Win by erasing any two consecutive similar alphabets

Given a string consisting of lower case alphabets. Rules of the Game: A player can choose a pair of similar consecutive characters and erase them.… Read More »

Game Development with Unity | Introduction

Game Development: The article “Do you want to make your own games?” introducing the basic concept of game development. As mentioned in the article, Unity… Read More »

Minimum Possible sum of digits in a positive multiple of N

Given a number N, find the minimum possible sum of digits that can be obtained from a positive Multiple of N. Constraints : 1<=N<=10^5. Examples:… Read More »

Game Theory (Normal-form game) | Set 3 (Game with Mixed Strategy)

Consider the following payoff matrix with respect to player A and solve it optimally. Solution: If a game has no saddle point then the game… Read More »

Game Theory (Normal – form game) | Set 1 (Introduction)

Game theory is a mathematical model used for decision making. It has applications in all fields of social science, as well as in logic and… Read More »

Card Shuffle Problem | TCS Digital Advanced Coding Question

You have 100 cards, numbered 1 to 100. You distribute them into k piles and collect back the piles in order. For example, if you… Read More »

Game Theory in Balanced Ternary Numeral System | (Moving 3k steps at a time)

Just like base 2 Binary numeral system having 0s and 1s as digits, Ternary(Trinary) Numeral System is a base 3 number system having 0s, 1s… Read More »

Predict the winner in Coin Game

There are two players P1 and P2 and two piles of coins consisting of M and N coins respectively. At each turn, a player can… Read More »

Predict the winner of the game on the basis of absolute difference of sum by selecting numbers

Given an array of N numbers. Two players X and Y play a game where at every step one player selects a number. One number… Read More »

Find the number of players who roll the dice when the dice output sequence is given

Given a string S and a number X. There are M players who roll the dice. A player keeps on rolling the dice until he… Read More »

Some Tricks to solve problems on Impartial games

How to solve problems that fall in the Finders keepers category in ‘Game Theory’? Note- Finders keepers game fall into the category of ‘Impartial Games’… Read More »

Number of ways for playing first move optimally in a NIM game

Two players A and B are playing NIM Game with each other. Both are playing optimally. Player A starts the game. The task is to… Read More »

Probability of A winning the match when individual probabilities of hitting the target given

Given four integers a, b, c and d. Player A & B try to score a penalty. Probability of A shooting the target is a… Read More »