\doxysection{Pyramic\+\_\+\+XO.\+h}
\hypertarget{_pyramic___x_o_8h_source}{}\label{_pyramic___x_o_8h_source}\mbox{\hyperlink{_pyramic___x_o_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ PYRAMIC\_XO\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ PYRAMIC\_XO\_H}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{_board_game___classes_8h}{BoardGame\_Classes.h}}"{}}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <cstdlib>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <ctime>}}
\DoxyCodeLine{00008\ \textcolor{keyword}{using\ namespace\ }std;}
\DoxyCodeLine{00009\ }
\DoxyCodeLine{00010\ \textcolor{comment}{//\ Pyramid\ Tic\ Tac\ Toe\ Board}}
\DoxyCodeLine{00011\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_pyramic___x_o___board_a9c1eaa827b47de30edead46703110c42}{Pyramic\_XO\_Board}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_board_ae5dfded241ee3644196e2f6074d1d0b1}{Board}}<char>\ \{}
\DoxyCodeLine{00012\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00013\ \ \ \ \ \textcolor{keywordtype}{bool}\ is\_valid\_position(\textcolor{keywordtype}{int}\ x,\ \textcolor{keywordtype}{int}\ y)\ \{}
\DoxyCodeLine{00014\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (x\ <\ 0\ ||\ x\ >=\ 3\ ||\ y\ <\ 0\ ||\ y\ >=\ 5)\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00015\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ start\ =\ (5\ -\/\ (2\ *\ x\ +\ 1))\ /\ 2;}
\DoxyCodeLine{00016\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ end\ =\ start\ +\ (2\ *\ x\ +\ 1);}
\DoxyCodeLine{00017\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (y\ >=\ start\ \&\&\ y\ <\ end);}
\DoxyCodeLine{00018\ \ \ \ \ \}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00021\ \ \ \ \ \mbox{\hyperlink{class_pyramic___x_o___board_a9c1eaa827b47de30edead46703110c42}{Pyramic\_XO\_Board}}()\ :\ \mbox{\hyperlink{class_board_ae5dfded241ee3644196e2f6074d1d0b1}{Board}}(3,\ 5)\ \{}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \{}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ 5;\ j++)\ \{}
\DoxyCodeLine{00024\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (is\_valid\_position(i,\ j))\ \{}
\DoxyCodeLine{00025\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j]\ =\ \textcolor{charliteral}{'.'};}
\DoxyCodeLine{00026\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00027\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j]\ =\ \textcolor{charliteral}{'\#'};\ \textcolor{comment}{//\ Invalid\ position}}
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00032\ \ \ \ \ \}}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_pyramic___x_o___board_a767d06c39f11d50e66006368f3ba0a9c}{update\_board}}(\mbox{\hyperlink{class_move}{Move<char>}}*\ move)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x\ =\ move-\/>\mbox{\hyperlink{class_move_a9d4f543a81e361f872d37bcfb64d5b55}{get\_x}}();}
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ y\ =\ move-\/>\mbox{\hyperlink{class_move_a96469802a55c9083a1e93c7edec8a00c}{get\_y}}();}
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ symbol\ =\ move-\/>\mbox{\hyperlink{class_move_a595bf740852c05a1cb425ef2640fd4ff}{get\_symbol}}();}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!is\_valid\_position(x,\ y))\ \{}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Invalid\ position!\ Not\ in\ pyramid\ shape.\(\backslash\)n"{}};}
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[x][y]\ !=\ \textcolor{charliteral}{'.'})\ \{}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Cell\ already\ occupied!\(\backslash\)n"{}};}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[x][y]\ =\ symbol;}
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_a5952baefabced65fecec333de638408d}{n\_moves}}++;}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00052\ \ \ \ \ \}}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_pyramic___x_o___board_aee5fc3596d78d746b5bcecd0beb496c9}{is\_win}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ symbol\ =\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}();}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ center\ column}}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[0][2]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[1][2]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[2][2]\ ==\ symbol)}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ rows}}
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \{}
\DoxyCodeLine{00063\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ start\ =\ (5\ -\/\ (2\ *\ i\ +\ 1))\ /\ 2;}
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ end\ =\ start\ +\ (2\ *\ i\ +\ 1);}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ start;\ j\ <=\ end\ -\/\ 3;\ j++)\ \{}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j\ +\ 1]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j\ +\ 2]\ ==\ symbol)}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ diagonals}}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[0][2]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[1][1]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[2][0]\ ==\ symbol)}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[0][2]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[1][3]\ ==\ symbol\ \&\&\ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[2][4]\ ==\ symbol)}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00078\ \ \ \ \ \}}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_pyramic___x_o___board_aab094db4f464cd7d1503a84858ff1adb}{is\_lose}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00082\ \ \ \ \ \}}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_pyramic___x_o___board_af4d28993edee58fa2630470d150a7c8d}{is\_draw}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Count\ valid\ cells\ (9\ in\ pyramid)}}
\DoxyCodeLine{00086\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ valid\_cells\ =\ 0;}
\DoxyCodeLine{00087\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ filled\_cells\ =\ 0;}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00089\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \{}
\DoxyCodeLine{00090\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ 5;\ j++)\ \{}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j]\ !=\ \textcolor{charliteral}{'\#'})\ \{}
\DoxyCodeLine{00092\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ valid\_cells++;}
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j]\ !=\ \textcolor{charliteral}{'.'})\ \{}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ filled\_cells++;}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (filled\_cells\ ==\ valid\_cells\ \&\&\ !\mbox{\hyperlink{class_pyramic___x_o___board_aee5fc3596d78d746b5bcecd0beb496c9}{is\_win}}(player));}
\DoxyCodeLine{00101\ \ \ \ \ \}}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_pyramic___x_o___board_a7088caff1b7b17ee7cc69b91c0b15305}{game\_is\_over}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_pyramic___x_o___board_aee5fc3596d78d746b5bcecd0beb496c9}{is\_win}}(player)\ ||\ \mbox{\hyperlink{class_pyramic___x_o___board_af4d28993edee58fa2630470d150a7c8d}{is\_draw}}(player);}
\DoxyCodeLine{00105\ \ \ \ \ \}}
\DoxyCodeLine{00106\ \};}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \textcolor{comment}{//\ Pyramid\ Player}}
\DoxyCodeLine{00109\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_pyramic___x_o___player_a011bd37a8db370b5e344d06011707aa9}{Pyramic\_XO\_Player}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}<char>\ \{}
\DoxyCodeLine{00110\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00111\ \ \ \ \ \mbox{\hyperlink{class_pyramic___x_o___player_a011bd37a8db370b5e344d06011707aa9}{Pyramic\_XO\_Player}}(\textcolor{keywordtype}{string}\ \mbox{\hyperlink{class_player_af0ad0d4ca8584d23a98c723cd703a4f6}{name}},\ \textcolor{keywordtype}{char}\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}})\ :\ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}(\mbox{\hyperlink{class_player_af0ad0d4ca8584d23a98c723cd703a4f6}{name}},\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}},\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}::\mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfaa36c6719f4d3207d858cf956ef1e93b6}{HUMAN}})\ \{\}}
\DoxyCodeLine{00112\ \};}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \textcolor{comment}{//\ Pyramid\ Random\ Player}}
\DoxyCodeLine{00115\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_pyramic___x_o___random_player_a836ca47c3aba562ecb6b8c2aa5a2e1b1}{Pyramic\_XO\_RandomPlayer}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}<char>\ \{}
\DoxyCodeLine{00116\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00117\ \ \ \ \ \mbox{\hyperlink{class_pyramic___x_o___random_player_a836ca47c3aba562ecb6b8c2aa5a2e1b1}{Pyramic\_XO\_RandomPlayer}}(\textcolor{keywordtype}{char}\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}})\ :\ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}(\textcolor{stringliteral}{"{}Random\ Computer"{}},\ \mbox{\hyperlink{class_player_a272d6c4dab769930d4f8074918e7708a}{symbol}},\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccf}{PlayerType}}::\mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfad19cbc472227d1e3d1d276c2cbc0e513}{COMPUTER}})\ \{}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ srand(time(0));}
\DoxyCodeLine{00119\ \ \ \ \ \}}
\DoxyCodeLine{00120\ \};}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00122\ \textcolor{comment}{//\ Pyramid\ UI}}
\DoxyCodeLine{00123\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_pyramic___x_o___u_i_a38ed6f77e7fda89d00885371b79beb3b}{Pyramic\_XO\_UI}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}<char>\ \{}
\DoxyCodeLine{00124\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00125\ \ \ \ \ \mbox{\hyperlink{class_pyramic___x_o___u_i_a38ed6f77e7fda89d00885371b79beb3b}{Pyramic\_XO\_UI}}()\ :\ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}(\textcolor{stringliteral}{"{}Welcome\ to\ Pyramid\ Tic-\/Tac-\/Toe!"{}},\ 3)\ \{\}}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ \ \ \ \ \mbox{\hyperlink{class_move}{Move<char>}}*\ \mbox{\hyperlink{class_pyramic___x_o___u_i_a6e4ece491287bd964b1dbe627d8aa765}{get\_move}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (player-\/>\mbox{\hyperlink{class_player_a2df3bd299bf7aecfa2275ec6902a60f8}{get\_type}}()\ ==\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfaa36c6719f4d3207d858cf956ef1e93b6}{PlayerType::HUMAN}})\ \{}
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x,\ y;}
\DoxyCodeLine{00130\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ player-\/>\mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\ <<\ \textcolor{stringliteral}{"{}\ ("{}}\ <<\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}()}
\DoxyCodeLine{00131\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <<\ \textcolor{stringliteral}{"{}),\ enter\ your\ move\ (row\ 0-\/2,\ column\ 0-\/4\ in\ pyramid\ shape):\ "{}};}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ \ \ \ \ cin\ >>\ x\ >>\ y;}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_move}{Move<char>}}(x,\ y,\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}());}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00136\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x,\ y;}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ x\ =\ rand()\ \%\ 3;}
\DoxyCodeLine{00139\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ y\ =\ rand()\ \%\ 5;}
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{while}\ (!is\_valid\_pyramid\_position(x,\ y));}
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ player-\/>\mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\ <<\ \textcolor{stringliteral}{"{}\ chooses\ position\ ("{}}\ <<\ x\ <<\ \textcolor{stringliteral}{"{},\ "{}}\ <<\ y\ <<\ \textcolor{stringliteral}{"{})\(\backslash\)n"{}};}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_move}{Move<char>}}(x,\ y,\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}());}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00145\ \ \ \ \ \}}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keywordtype}{bool}\ is\_valid\_pyramid\_position(\textcolor{keywordtype}{int}\ x,\ \textcolor{keywordtype}{int}\ y)\ \{}
\DoxyCodeLine{00149\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ start\ =\ (5\ -\/\ (2\ *\ x\ +\ 1))\ /\ 2;}
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ end\ =\ start\ +\ (2\ *\ x\ +\ 1);}
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ (x\ >=\ 0\ \&\&\ x\ <\ 3\ \&\&\ y\ >=\ start\ \&\&\ y\ <\ end);}
\DoxyCodeLine{00152\ \ \ \ \ \}}
\DoxyCodeLine{00153\ \};}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ PYRAMIC\_XO\_H}}

\end{DoxyCode}
