\doxysection{Numerical\+\_\+\+UI.\+h}
\hypertarget{_numerical___u_i_8h_source}{}\label{_numerical___u_i_8h_source}\mbox{\hyperlink{_numerical___u_i_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{_board_game___classes_8h}{BoardGame\_Classes.h}}"{}}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{_numerical___player_8h}{Numerical\_Player.h}}"{}}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{_numerical___board_8h}{Numerical\_Board.h}}"{}}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <cstdlib>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <ctime>}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_numerical___u_i_a2df77448a71627dbeb30f4c1694e5b2d}{Numerical\_UI}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}<int>\ \{}
\DoxyCodeLine{00009\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00010\ \ \ \ \ \mbox{\hyperlink{class_numerical___u_i_a2df77448a71627dbeb30f4c1694e5b2d}{Numerical\_UI}}()\ :\ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}<int>(\textcolor{stringliteral}{"{}Numerical\ Tic\ Tac\ Toe"{}},\ 2)\ \{\}}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_numerical___u_i_a7d1331dbd7b9c133cbd2859f92e598bd}{display\_board\_matrix}}(\textcolor{keyword}{const}\ vector<vector<int>>\&\ b)\textcolor{keyword}{\ const\ }\{}
\DoxyCodeLine{00013\ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)nBoard:\(\backslash\)n"{}};}
\DoxyCodeLine{00014\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ r\ :\ b)\ \{}
\DoxyCodeLine{00015\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ c\ :\ r)}
\DoxyCodeLine{00016\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ (c\ ==\ 0\ ?\ \textcolor{charliteral}{'.'}\ :\ char(\textcolor{charliteral}{'0'}\ +\ c))\ <<\ \textcolor{stringliteral}{"{}\ "{}};}
\DoxyCodeLine{00017\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ endl;}
\DoxyCodeLine{00018\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00019\ \ \ \ \ \}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \ \ \ \ \mbox{\hyperlink{class_move}{Move<int>}}*\ \mbox{\hyperlink{class_numerical___u_i_a740484f354117eb09bafcd3092b41cd6}{get\_move}}(\mbox{\hyperlink{class_player}{Player<int>}}*\ p)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ np\ =\ (\mbox{\hyperlink{class_numerical___player}{Numerical\_Player}}*)p;}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x,\ y,\ val;}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Computer\ move}}
\DoxyCodeLine{00026\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (p-\/>\mbox{\hyperlink{class_player_a2df3bd299bf7aecfa2275ec6902a60f8}{get\_type}}()\ ==\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfad19cbc472227d1e3d1d276c2cbc0e513}{PlayerType::COMPUTER}})\ \{}
\DoxyCodeLine{00027\ \ \ \ \ \ \ \ \ \ \ \ \ srand(time(0));}
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{do}\ \{\ x\ =\ rand()\ \%\ 3;\ y\ =\ rand()\ \%\ 3;\ \}\ \textcolor{keywordflow}{while}\ (p-\/>\mbox{\hyperlink{class_player_a508617eddfae8915d098102d480fc888}{get\_board\_ptr}}()-\/>get\_board\_matrix()[x][y]\ !=\ 0);}
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ \ \ \ \ val\ =\ np-\/>isOdd\ ?\ (rand()\ \%\ 5)\ *\ 2\ +\ 1\ :\ (rand()\ \%\ 4)\ *\ 2\ +\ 2;}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)nComputer\ played\ "{}}\ <<\ val\ <<\ \textcolor{stringliteral}{"{}\ at\ ("{}}\ <<\ x\ <<\ \textcolor{stringliteral}{"{},"{}}\ <<\ y\ <<\ \textcolor{stringliteral}{"{})\(\backslash\)n"{}};}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_move}{Move<int>}}(x,\ y,\ val);}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Human\ move}}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (\textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}\(\backslash\)n"{}}\ <<\ p-\/>\mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\ <<\ \textcolor{stringliteral}{"{}\ enter\ row\ and\ column\ (0-\/2):\ "{}};}
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \ \ \ \ cin\ >>\ x\ >>\ y;}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Enter\ a\ "{}}\ <<\ (np-\/>isOdd\ ?\ \textcolor{stringliteral}{"{}odd"{}}\ :\ \textcolor{stringliteral}{"{}even"{}})\ <<\ \textcolor{stringliteral}{"{}\ number:\ "{}};}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \ \ \ \ cin\ >>\ val;}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (x\ <\ 0\ ||\ x\ >\ 2\ ||\ y\ <\ 0\ ||\ y\ >\ 2)\ \{\ cout\ <<\ \textcolor{stringliteral}{"{}Invalid\ cell.\(\backslash\)n"{}};\ \textcolor{keywordflow}{continue};\ \}}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (np-\/>isOdd\ \&\&\ val\ \%\ 2\ ==\ 0)\ \{\ cout\ <<\ \textcolor{stringliteral}{"{}You\ must\ use\ odd\ numbers.\(\backslash\)n"{}};\ \textcolor{keywordflow}{continue};\ \}}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!np-\/>isOdd\ \&\&\ val\ \%\ 2\ !=\ 0)\ \{\ cout\ <<\ \textcolor{stringliteral}{"{}You\ must\ use\ even\ numbers.\(\backslash\)n"{}};\ \textcolor{keywordflow}{continue};\ \}}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_move}{Move<int>}}(x,\ y,\ val);}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00046\ \ \ \ \ \}}
\DoxyCodeLine{00047\ }
\DoxyCodeLine{00048\ \ \ \ \ \mbox{\hyperlink{class_player}{Player<int>}}*\ \mbox{\hyperlink{class_numerical___u_i_a8080e8fa3d81fa39ae59b4554ca0b880}{create\_player}}(\textcolor{keywordtype}{string}\&\ n,\ \textcolor{keywordtype}{int}\ symbol,\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}\ t)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_numerical___player}{Numerical\_Player}}(n,\ \textcolor{keyword}{true},\ t);}
\DoxyCodeLine{00050\ \ \ \ \ \}}
\DoxyCodeLine{00051\ \};}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00054\ }

\end{DoxyCode}
