Question: I was trying to use another question found on the website to build a table of size 3x3 to represent payoffs in a multiple player game. I used as an example the answer given in this question [Creating a Payoff Matrix Using LaTeX Tabular Environment](https://tex.stackexchange.com/questions/249480/creating-a-payoff-matrix-using-latex-tabular-environment), but while trying to adapt it something is not working. For reference, I will put the code I was working on.

```
\documentclass{article}
\usepackage{multirow,array}
\begin{document}
\begin{table}
    \centering 
    \setlength{\extrarowheight}{2pt}
    \begin{tabular}{cccc|c|c|c|}
        & \multicolumn{1}{c}{} & \multicolumn{2}{c}{} & \multicolumn{3}{c}{Player B}\\
        & \multicolumn{1}{c}{} & \multicolumn{1}{c}{$R$}  & \multicolumn{1}{c}{$P$} & \multicolumn{1}{c}{$S$} \\\cline{4-5}
        \multirow{3}*{Player A}  
        & $R$ & $(0,0)$ & $(-4,4)$ & $(4,-4)$ \\\cline{4-5}
        & $P$ & $(4,-4)$ & $(0,0)$ & $(-4,4)$ \\\cline{4-5}
        & $S$ & $(-4,4)$ & $(4,-4)$ & $(0,0)$ \\\cline{4-5}
    \end{tabular}
\end{table}
\end{document} 

```

This is the output I got, do you have any clues on why it is doing so? Thanks in advance!
[![enter image description here](https://i.stack.imgur.com/EKWwp.png)](https://i.stack.imgur.com/EKWwp.png)

Answer: 
I would use an `array` environment instead of a `tabular` environment; this'll save you from having to enter lots of `$` symbols. There appears to be no need for a `table` environment "wrapper". Finally, your code appears to define 7 columns, but only 5 seem to be needed.

I'm assuming that `R`, `P`, and `S` denote "rock", "paper", and "scissors". Is this correct? :-)

[![enter image description here](https://i.stack.imgur.com/hm6z7.png)](https://i.stack.imgur.com/hm6z7.png)

```
\documentclass{article} % or some other suitable document class
\usepackage{array}      % for \extrarowheight macro
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\begin{document}
\[
\setlength{\extrarowheight}{2pt}
    \begin{array}{rr|c|c|c|}
        & \mc{}         & \multicolumn{3}{c}{\textup{Player $B$}} \\
        & \mc{}         & \mc{R} & \mc{P} & \mc{S} \\ \cline{3-5}
        & R             &  (0,0) & (-4,4) & (4,-4) \\ \cline{3-5}
        \textup{Player $A$}
        & P             & (4,-4) &  (0,0) & (-4,4) \\ \cline{3-5}
        & S             & (-4,4) & (4,-4) &  (0,0) \\ \cline{3-5}
    \end{array}
\]
\end{document}

```
```tex
\documentclass{article}
\usepackage{multirow,array}
\begin{document}
\begin{table}
    \setlength{\extrarowheight}{2pt}
    \begin{tabular}{cc|c|c|c|}
        \multicolumn{2}{c}{} & \multicolumn{3}{c}{Player B}\\
        \multicolumn{2}{c}{} & \multicolumn{1}{c}{R} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{S}\\ \cline{3-5}
        \multirow{3}{*}{Player A} & R & (0,0) & (-4,4) & (4,-4)\\ \cline{3-5}
        & P & (4,-4) & (0,0) & (-4,4)\\ \cline{3-5}
        & S & (-4,4) & (4,-4) & (0,0)\\ \cline{3-5}
    \end{tabular}
\end{table}   
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/5wO7u.png)](https://i.stack.imgur.com/5wO7u.png)