Open In App

Practice Problems on Game Theory

Last Updated : 28 Sep, 2023
Like Article

Game Theory is a topic in competitive programming that involves a certain type of problem, where there are some players who play a game based on given rules and the task is often to find the winner or the winning moves. Game Theory is often asked in short contests with a mixture of other topics like range querying or greedy or dynamic programming.

Objectives Game Theory for Competitive Programming:

  • Here we will focus on two-player games that do not contain random elements.
  • Our goal is to find a strategy we can follow to win the game no matter what the opponent does if such a strategy exists. 
  • Game theory or combinatorics game theory in which we have perfect information (that is no randomization like a coin toss) such as game rules, player’s turn, minimum and maximum involved in the problem statements, and some conditions and constraints.
  • There will be three possible cases/ state win, loss or tie.
  • A terminal condition is well-defined/ specified clearly.
    E.g. player who picks the last coin will win the game, or a player who picks the second last time coin will win the game or something like that.
  • It is assumed that the game will end at some point after a fixed number of moves. Unlike chess, where you can have an unlimited number of moves possible especially when you are left with the only king, but if you add an extra constraint that says “game should be ended within ‘n’ numbers of moves”, that will be a terminal condition. This is the kind of assumption a game theory is looking for.
  • It turns out that there is a general strategy for such games, and we can analyze the games using the nim theory.
  • Initially, we will analyze simple games where players remove sticks from heaps, and after this, we will generalize the strategy used in those games to other games.

Practice Problems on Game Theory:

Find the winner in nim-game
Game of N stones where each player can remove 1, 3 or 4
Choice of Area
Finding optimal move in Tic-Tac-Toe using Minimax Algorithm in Game Theory
Optimal Strategy for a Game
Find the player who will win by choosing a number in range [1, K] with sum total N
Optimal Strategy for the Divisor game using Dynamic Programming
Chessboard Pawn-Pawn game
Find the winner of the game with N piles of boxes
Coin game of two corners
Josephus Problem
Variation in Nim Game
Game of replacing array elements
Combinatorial Game Theory
Find winner in game of N balls, in which a player can remove any balls in range [A, B] in a single move
Find the winner of a game of removing any number of stones from the least indexed non-empty pile from given N piles
A Binary String Game
Two player game in which a player can remove all occurrences of a number
Make a palindromic string from given string
Find the player who will win the Coin game
Find the winner of the Game
Optimal Strategy for a Game
Find the winner of the Game to Win by erasing any two consecutive similar alphabets
Find the winner of a game of removing at most 3 stones from a pile in each turn
Pen Distribution Problem
Find the winner of game of repeatedly removing the first character to empty given string
Find the player who wins the game by removing the last of given N cards
Winner in the Rock-Paper-Scissor game using Bit manipulation
Optimal Strategy for a Game | Special Gold Coin
Predict the winner of the game on the basis of absolute difference of sum by selecting numbers
Find probability that a player wins when probabilities of hitting the target are given
Find winner when players remove multiples of A or B from Array in each turn
Predict the winner of a card game of removing K cards in each turn such that Bitwise AND of K and size of pile is 0
Optimal strategy for a Game with modifications
Number of ways for playing first move optimally in a NIM game
Probability of A winning the match when individual probabilities of hitting the target given
Predict the winner of the game | Sprague-Grundy
Game of Chocolates | Wythoff’s Game
Minimum operations to reduce N to a prime number by subtracting with its highest divisor
Find the winner of a game of donating i candies in every i-th move
Largest odd divisor Game to check which player wins

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads