\doxysection{Board\+Game\+\_\+\+Classes.\+h}
\hypertarget{_board_game___classes_8h_source}{}\label{_board_game___classes_8h_source}\mbox{\hyperlink{_board_game___classes_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ \_BOARDGAME\_CLASSES\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ \_BOARDGAME\_CLASSES\_H}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <iomanip>}}
\DoxyCodeLine{00008\ \textcolor{keyword}{using\ namespace\ }std;}
\DoxyCodeLine{00009\ }
\DoxyCodeLine{00011\ \textcolor{comment}{//\ Forward\ declarations}}
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_player}{Player}};}
\DoxyCodeLine{00015\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_move}{Move}};}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00018\ \textcolor{comment}{//\ Class\ declarations}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00024\ \textcolor{keyword}{enum\ class}\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ \{}
\DoxyCodeLine{00025\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfaa36c6719f4d3207d858cf956ef1e93b6}{HUMAN}},\ \ \ \ \ }
\DoxyCodeLine{00026\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfad19cbc472227d1e3d1d276c2cbc0e513}{COMPUTER}},\ \ }
\DoxyCodeLine{00027\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfa0a40e3c91a3a55c9a37428c6d194d0e5}{AI}},\ \ \ \ \ \ \ \ }
\DoxyCodeLine{00028\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfa170e02e86972c2be8559884cc3c12254}{RANDOM}}\ \ \ \ \ }
\DoxyCodeLine{00029\ \};}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00039\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00040\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_board_ae5dfded241ee3644196e2f6074d1d0b1}{Board}}\ \{}
\DoxyCodeLine{00041\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_a948d978e3b5fc460559b588f5dee9572}{rows}};\ \ \ \ \ \ \ \ }
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_afaf8842d9d52ac724e8c2f5642ecafc7}{columns}};\ \ \ \ \ }
\DoxyCodeLine{00044\ \ \ \ \ vector<vector<T>>\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}};\ }
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_a5952baefabced65fecec333de638408d}{n\_moves}}\ =\ 0;\ }
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00047\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00051\ \ \ \ \ \mbox{\hyperlink{class_board_ae5dfded241ee3644196e2f6074d1d0b1}{Board}}(\textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_a948d978e3b5fc460559b588f5dee9572}{rows}},\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_afaf8842d9d52ac724e8c2f5642ecafc7}{columns}})}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{class_board_a948d978e3b5fc460559b588f5dee9572}{rows}}(\mbox{\hyperlink{class_board_a948d978e3b5fc460559b588f5dee9572}{rows}}),\ \mbox{\hyperlink{class_board_afaf8842d9d52ac724e8c2f5642ecafc7}{columns}}(\mbox{\hyperlink{class_board_afaf8842d9d52ac724e8c2f5642ecafc7}{columns}}),\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}(\mbox{\hyperlink{class_board_a948d978e3b5fc460559b588f5dee9572}{rows}},\ vector<T>(\mbox{\hyperlink{class_board_afaf8842d9d52ac724e8c2f5642ecafc7}{columns}}))\ \{}
\DoxyCodeLine{00053\ \ \ \ \ \}}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_board_a138a6378af669dd1ce55dc11217aea48}{\string~Board}}()\ \{\}}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_board_a93d9dec601dda58b7e206ccb47633e57}{update\_board}}(\mbox{\hyperlink{class_move}{Move<T>}}*\ move)\ =\ 0;}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_board_ab316fe3e79677b4617fc3d90d6c48f33}{is\_win}}(\mbox{\hyperlink{class_player}{Player<T>}}*)\ =\ 0;}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_board_a207d5f6feb77f81c51d1462f0245890d}{is\_lose}}(\mbox{\hyperlink{class_player}{Player<T>}}*)\ =\ 0;}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_board_a8dbe2a243881986f3e53b45799d377fc}{is\_draw}}(\mbox{\hyperlink{class_player}{Player<T>}}*)\ =\ 0;}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_board_ae0e4575ec3cc4b6eb9f367ffb2beed13}{game\_is\_over}}(\mbox{\hyperlink{class_player}{Player<T>}}*)\ =\ 0;}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00082\ \ \ \ \ vector<vector<T>>\ \mbox{\hyperlink{class_board_a117f2e61fdb7deccca333bbbc9c62d3a}{get\_board\_matrix}}()\textcolor{keyword}{\ const\ }\{}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}};}
\DoxyCodeLine{00084\ \ \ \ \ \}}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_a93b130eff67bd4476fab27be8341cb78}{get\_rows}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_board_a948d978e3b5fc460559b588f5dee9572}{rows}};\ \}}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00090\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_board_ac665e1ed1f49125fab248e2c9ddfd608}{get\_columns}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_board_afaf8842d9d52ac724e8c2f5642ecafc7}{columns}};\ \}}
\DoxyCodeLine{00091\ \};}
\DoxyCodeLine{00092\ }
\DoxyCodeLine{00093\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00099\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00100\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_move_a100102cb072a2857304023233dac7b42}{Move}}\ \{}
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{keywordtype}{int}\ x;\ \ \ \ \ \ }
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordtype}{int}\ y;\ \ \ \ \ \ }
\DoxyCodeLine{00103\ \ \ \ \ T\ symbol;\ \ \ }
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00107\ \ \ \ \ \mbox{\hyperlink{class_move_a100102cb072a2857304023233dac7b42}{Move}}(\textcolor{keywordtype}{int}\ x,\ \textcolor{keywordtype}{int}\ y,\ T\ symbol)\ :\ x(x),\ y(y),\ symbol(symbol)\ \{\}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_move_a9d4f543a81e361f872d37bcfb64d5b55}{get\_x}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ x;\ \}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_move_a96469802a55c9083a1e93c7edec8a00c}{get\_y}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ y;\ \}}
\DoxyCodeLine{00114\ }
\DoxyCodeLine{00116\ \ \ \ \ T\ \mbox{\hyperlink{class_move_a595bf740852c05a1cb425ef2640fd4ff}{get\_symbol}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ symbol;\ \}}
\DoxyCodeLine{00117\ \};}
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00125\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00126\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}\ \{}
\DoxyCodeLine{00127\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordtype}{string}\ \mbox{\hyperlink{class_player_af0ad0d4ca8584d23a98c723cd703a4f6}{name}};\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00129\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ \mbox{\hyperlink{class_player_a81a15b1b507fd5f2157fb15bf0fd283f}{type}};\ \ \ \ \ }
\DoxyCodeLine{00130\ \ \ \ \ T\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}};\ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00131\ \ \ \ \ \mbox{\hyperlink{class_board}{Board<T>}}*\ \mbox{\hyperlink{class_player_a26249e756f850b6585267bfbc928ac79}{boardPtr}};\ \ }
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00137\ \ \ \ \ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}(\textcolor{keywordtype}{string}\ n,\ T\ s,\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ t)}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{class_player_af0ad0d4ca8584d23a98c723cd703a4f6}{name}}(n),\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}}(s),\ \mbox{\hyperlink{class_player_a81a15b1b507fd5f2157fb15bf0fd283f}{type}}(t),\ \mbox{\hyperlink{class_player_a26249e756f850b6585267bfbc928ac79}{boardPtr}}(nullptr)\ \{}
\DoxyCodeLine{00139\ \ \ \ \ \}}
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00141\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_player_aac1f2ab2a8e2aa0336d302c16068020e}{\string~Player}}()\ \{\}}
\DoxyCodeLine{00142\ }
\DoxyCodeLine{00144\ \ \ \ \ \textcolor{keywordtype}{string}\ \mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_player_af0ad0d4ca8584d23a98c723cd703a4f6}{name}};\ \}}
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00147\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ \mbox{\hyperlink{class_player_a2df3bd299bf7aecfa2275ec6902a60f8}{get\_type}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_player_a81a15b1b507fd5f2157fb15bf0fd283f}{type}};\ \}}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00150\ \ \ \ \ T\ \mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}};\ \}}
\DoxyCodeLine{00151\ }
\DoxyCodeLine{00153\ \ \ \ \ \mbox{\hyperlink{class_board}{Board<T>}}*\ \mbox{\hyperlink{class_player_a508617eddfae8915d098102d480fc888}{get\_board\_ptr}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_player_a26249e756f850b6585267bfbc928ac79}{boardPtr}};\ \}}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00156\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_player_a3617a3ad0db435176a06948065f9a3a6}{set\_board\_ptr}}(\mbox{\hyperlink{class_board}{Board<T>}}*\ b)\ \{\ \mbox{\hyperlink{class_player_a26249e756f850b6585267bfbc928ac79}{boardPtr}}\ =\ b;\ \}}
\DoxyCodeLine{00157\ \};}
\DoxyCodeLine{00158\ }
\DoxyCodeLine{00159\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00165\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00166\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}\ \{}
\DoxyCodeLine{00167\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00168\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{class_u_i_a6c79c489ae9aa3a7860fb58e5a14ddfe}{cell\_width}};\ }
\DoxyCodeLine{00169\ }
\DoxyCodeLine{00173\ \ \ \ \ \textcolor{keywordtype}{string}\ \mbox{\hyperlink{class_u_i_a8617bbf64a9ddf11ea6231912044805d}{get\_player\_name}}(\textcolor{keywordtype}{string}\ player\_label)\ \{}
\DoxyCodeLine{00174\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{string}\ name;}
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Enter\ "{}}\ <<\ player\_label\ <<\ \textcolor{stringliteral}{"{}\ name:\ "{}};}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ getline(cin\ >>\ ws,\ name);}
\DoxyCodeLine{00177\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ name;}
\DoxyCodeLine{00178\ \ \ \ \ \}}
\DoxyCodeLine{00179\ }
\DoxyCodeLine{00183\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ \mbox{\hyperlink{class_u_i_ae62d61367ea51a5d7532db3b830c6445}{get\_player\_type\_choice}}(\textcolor{keywordtype}{string}\ player\_label,\ \textcolor{keyword}{const}\ vector<string>\&\ options)\ \{}
\DoxyCodeLine{00184\ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Choose\ "{}}\ <<\ player\_label\ <<\ \textcolor{stringliteral}{"{}\ type:\(\backslash\)n"{}};}
\DoxyCodeLine{00185\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{size\_t}\ i\ =\ 0;\ i\ <\ options.size();\ ++i)}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ i\ +\ 1\ <<\ \textcolor{stringliteral}{"{}.\ "{}}\ <<\ options[i]\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{00187\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ choice;}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ cin\ >>\ choice;}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (choice\ ==\ 2)\ ?\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfad19cbc472227d1e3d1d276c2cbc0e513}{PlayerType::COMPUTER}}\ :\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfaa36c6719f4d3207d858cf956ef1e93b6}{PlayerType::HUMAN}};}
\DoxyCodeLine{00190\ \ \ \ \ \}}
\DoxyCodeLine{00191\ }
\DoxyCodeLine{00192\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00196\ \ \ \ \ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}(\textcolor{keywordtype}{string}\ message,\ \textcolor{keywordtype}{int}\ cell\_display\_width)}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{class_u_i_a6c79c489ae9aa3a7860fb58e5a14ddfe}{cell\_width}}(cell\_display\_width)\ \{}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ cout\ <<\ message\ <<\ endl;}
\DoxyCodeLine{00199\ \ \ \ \ \}}
\DoxyCodeLine{00200\ }
\DoxyCodeLine{00201\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_u_i_a1012e508ff7df030714c62ddf6b261a7}{\string~UI}}()\ \{\}}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00204\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_u_i_a1eead148ee8726b8ea329c2cd8841d18}{display\_message}}(\textcolor{keywordtype}{string}\ message)\ \{\ cout\ <<\ message\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};\ \}}
\DoxyCodeLine{00205\ }
\DoxyCodeLine{00209\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_move}{Move<T>}}*\ \mbox{\hyperlink{class_u_i_a8befa259c38c57e6ae2e8ed81c476337}{get\_move}}(\mbox{\hyperlink{class_player}{Player<T>}}*)\ =\ 0;}
\DoxyCodeLine{00210\ }
\DoxyCodeLine{00214\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_player}{Player<T>}}**\ \mbox{\hyperlink{class_u_i_a6966a040c995b2292e5edddaa94f889a}{setup\_players}}();}
\DoxyCodeLine{00215\ }
\DoxyCodeLine{00219\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_player}{Player<T>}}*\ \mbox{\hyperlink{class_u_i_af9f043033208286cd56240a1f060dd7b}{create\_player}}(\textcolor{keywordtype}{string}\&\ name,\ T\ symbol,\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ type)\ =\ 0;}
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00224\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_u_i_a5d4655d5ff273e284fd68b8547483a23}{display\_board\_matrix}}(\textcolor{keyword}{const}\ vector<vector<T>>\&\ matrix)\textcolor{keyword}{\ const\ }\{}
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (matrix.empty()\ ||\ matrix[0].empty())\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00226\ }
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ rows\ =\ matrix.size();}
\DoxyCodeLine{00228\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ cols\ =\ matrix[0].size();}
\DoxyCodeLine{00229\ }
\DoxyCodeLine{00230\ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n\ \ \ \ "{}};}
\DoxyCodeLine{00231\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ cols;\ ++j)}
\DoxyCodeLine{00232\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ setw(\mbox{\hyperlink{class_u_i_a6c79c489ae9aa3a7860fb58e5a14ddfe}{cell\_width}}\ +\ 1)\ <<\ j;}
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n\ \ \ "{}}\ <<\ string((\mbox{\hyperlink{class_u_i_a6c79c489ae9aa3a7860fb58e5a14ddfe}{cell\_width}}\ +\ 2)\ *\ cols,\ \textcolor{charliteral}{'-\/'})\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{00234\ }
\DoxyCodeLine{00235\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ rows;\ ++i)\ \{}
\DoxyCodeLine{00236\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ setw(2)\ <<\ i\ <<\ \textcolor{stringliteral}{"{}\ |"{}};}
\DoxyCodeLine{00237\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ cols;\ ++j)}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ setw(\mbox{\hyperlink{class_u_i_a6c79c489ae9aa3a7860fb58e5a14ddfe}{cell\_width}})\ <<\ matrix[i][j]\ <<\ \textcolor{stringliteral}{"{}\ |"{}};}
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n\ \ \ "{}}\ <<\ string((\mbox{\hyperlink{class_u_i_a6c79c489ae9aa3a7860fb58e5a14ddfe}{cell\_width}}\ +\ 2)\ *\ cols,\ \textcolor{charliteral}{'-\/'})\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{00240\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ cout\ <<\ endl;}
\DoxyCodeLine{00242\ \ \ \ \ \}}
\DoxyCodeLine{00243\ \};}
\DoxyCodeLine{00244\ }
\DoxyCodeLine{00245\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00251\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00252\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_game_manager_addaf3682d9783bdc432a8e3273b5b92c}{GameManager}}\ \{}
\DoxyCodeLine{00253\ \ \ \ \ \mbox{\hyperlink{class_board}{Board<T>}}*\ boardPtr;\ \ \ \ }
\DoxyCodeLine{00254\ \ \ \ \ \mbox{\hyperlink{class_player}{Player<T>}}*\ players[2];\ }
\DoxyCodeLine{00255\ \ \ \ \ \mbox{\hyperlink{class_u_i}{UI<T>}}*\ ui;\ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00256\ }
\DoxyCodeLine{00257\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00261\ \ \ \ \ \mbox{\hyperlink{class_game_manager_addaf3682d9783bdc432a8e3273b5b92c}{GameManager}}(\mbox{\hyperlink{class_board}{Board<T>}}*\ b,\ \mbox{\hyperlink{class_player}{Player<T>}}*\ p[2],\ \mbox{\hyperlink{class_u_i}{UI<T>}}*\ u)}
\DoxyCodeLine{00262\ \ \ \ \ \ \ \ \ :\ boardPtr(b),\ ui(u)\ \{}
\DoxyCodeLine{00263\ \ \ \ \ \ \ \ \ players[0]\ =\ p[0];}
\DoxyCodeLine{00264\ \ \ \ \ \ \ \ \ players[1]\ =\ p[1];}
\DoxyCodeLine{00265\ \ \ \ \ \ \ \ \ players[0]-\/>\mbox{\hyperlink{class_player_a3617a3ad0db435176a06948065f9a3a6}{set\_board\_ptr}}(b);}
\DoxyCodeLine{00266\ \ \ \ \ \ \ \ \ players[1]-\/>set\_board\_ptr(b);}
\DoxyCodeLine{00267\ \ \ \ \ \}}
\DoxyCodeLine{00268\ }
\DoxyCodeLine{00272\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_game_manager_a71f46d5189dac5c773f608cea1b5a203}{run}}()\ \{}
\DoxyCodeLine{00273\ \ \ \ \ \ \ \ \ ui-\/>display\_board\_matrix(boardPtr-\/>get\_board\_matrix());}
\DoxyCodeLine{00274\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_player}{Player<T>}}*\ currentPlayer\ =\ players[0];}
\DoxyCodeLine{00275\ }
\DoxyCodeLine{00276\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (\textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00277\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ :\ \{0,\ 1\})\ \{}
\DoxyCodeLine{00278\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ currentPlayer\ =\ players[i];}
\DoxyCodeLine{00279\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_move}{Move<T>}}*\ move\ =\ ui-\/>get\_move(currentPlayer);}
\DoxyCodeLine{00280\ }
\DoxyCodeLine{00281\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (!boardPtr-\/>update\_board(move))}
\DoxyCodeLine{00282\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ move\ =\ ui-\/>get\_move(currentPlayer);}
\DoxyCodeLine{00283\ }
\DoxyCodeLine{00284\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ui-\/>display\_board\_matrix(boardPtr-\/>get\_board\_matrix());}
\DoxyCodeLine{00285\ }
\DoxyCodeLine{00286\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (boardPtr-\/>is\_win(currentPlayer))\ \{}
\DoxyCodeLine{00287\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ui-\/>display\_message(currentPlayer-\/>\mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\ +\ \textcolor{stringliteral}{"{}\ wins!"{}});}
\DoxyCodeLine{00288\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00289\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00290\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (boardPtr-\/>is\_lose(currentPlayer))\ \{}
\DoxyCodeLine{00291\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ui-\/>display\_message(players[1\ -\/\ i]-\/>get\_name()\ +\ \textcolor{stringliteral}{"{}\ wins!"{}});}
\DoxyCodeLine{00292\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00293\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00294\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (boardPtr-\/>is\_draw(currentPlayer))\ \{}
\DoxyCodeLine{00295\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ui-\/>display\_message(\textcolor{stringliteral}{"{}Draw!"{}});}
\DoxyCodeLine{00296\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00297\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00298\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00299\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00300\ \ \ \ \ \}}
\DoxyCodeLine{00301\ \};}
\DoxyCodeLine{00302\ }
\DoxyCodeLine{00303\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00307\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00308\ \mbox{\hyperlink{class_player}{Player<T>}}**\ \mbox{\hyperlink{class_u_i_a6966a040c995b2292e5edddaa94f889a}{UI<T>::setup\_players}}()\ \{}
\DoxyCodeLine{00309\ \ \ \ \ \mbox{\hyperlink{class_player}{Player<T>}}**\ players\ =\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_player}{Player<T>}}*[2];}
\DoxyCodeLine{00310\ \ \ \ \ vector<string>\ type\_options\ =\ \{\ \textcolor{stringliteral}{"{}Human"{}},\ \textcolor{stringliteral}{"{}Computer"{}}\ \};}
\DoxyCodeLine{00311\ }
\DoxyCodeLine{00312\ \ \ \ \ \textcolor{keywordtype}{string}\ nameX\ =\ \mbox{\hyperlink{class_u_i_a8617bbf64a9ddf11ea6231912044805d}{get\_player\_name}}(\textcolor{stringliteral}{"{}Player\ X"{}});}
\DoxyCodeLine{00313\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ typeX\ =\ \mbox{\hyperlink{class_u_i_ae62d61367ea51a5d7532db3b830c6445}{get\_player\_type\_choice}}(\textcolor{stringliteral}{"{}Player\ X"{}},\ type\_options);}
\DoxyCodeLine{00314\ \ \ \ \ players[0]\ =\ \mbox{\hyperlink{class_u_i_af9f043033208286cd56240a1f060dd7b}{create\_player}}(nameX,\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(\textcolor{charliteral}{'X'}),\ typeX);}
\DoxyCodeLine{00315\ }
\DoxyCodeLine{00316\ \ \ \ \ \textcolor{keywordtype}{string}\ nameO\ =\ \mbox{\hyperlink{class_u_i_a8617bbf64a9ddf11ea6231912044805d}{get\_player\_name}}(\textcolor{stringliteral}{"{}Player\ O"{}});}
\DoxyCodeLine{00317\ \ \ \ \ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ typeO\ =\ \mbox{\hyperlink{class_u_i_ae62d61367ea51a5d7532db3b830c6445}{get\_player\_type\_choice}}(\textcolor{stringliteral}{"{}Player\ O"{}},\ type\_options);}
\DoxyCodeLine{00318\ \ \ \ \ players[1]\ =\ \mbox{\hyperlink{class_u_i_af9f043033208286cd56240a1f060dd7b}{create\_player}}(nameO,\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(\textcolor{charliteral}{'O'}),\ typeO);}
\DoxyCodeLine{00319\ }
\DoxyCodeLine{00320\ \ \ \ \ \textcolor{keywordflow}{return}\ players;}
\DoxyCodeLine{00321\ \}}
\DoxyCodeLine{00322\ }
\DoxyCodeLine{00323\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \_BOARDGAME\_CLASSES\_H\#pragma\ once}}

\end{DoxyCode}
