Skip to content

Instantly share code, notes, and snippets.

@TexAgg
Created December 10, 2016 02:26
Show Gist options
  • Save TexAgg/6ec021bda8594f6752c350248d91e794 to your computer and use it in GitHub Desktop.
Save TexAgg/6ec021bda8594f6752c350248d91e794 to your computer and use it in GitHub Desktop.
A package for doing handy calculations with game-theory-style matrix games.
(* ::Package:: *)
(* A package for doing handy calculations with game-theory-style matrix games. *)
BeginPackage["MatrixGame`"]
getSaddlePoints::usage = "Get the saddle points of a matrix game m"
Begin["`Private`"]
isRowMin[i_, j_, m_] := m[[i,j]]==Min[m[[i]]]
isColMax[i_,j_,m_]:=m[[i,j]]==Max[m[[All,j]]]
getSaddlePoints[m_] := Select[Range/@Dimensions[m]//Tuples, isRowMin[#[[1]],#[[2]],m]&&isColMax[#[[1]],#[[2]],m]&]
End[]
EndPackage[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment