\doxysection{Ultimate\+Tic\+Tac\+Toe.\+h}
\hypertarget{_ultimate_tic_tac_toe_8h_source}{}\label{_ultimate_tic_tac_toe_8h_source}\mbox{\hyperlink{_ultimate_tic_tac_toe_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ ULTIMATETICTACTOE\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ ULTIMATETICTACTOE\_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}{//\ Ultimate\ Tic\ Tac\ Toe\ Board}}
\DoxyCodeLine{00011\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_ultimate_tic_tac_toe_board_a9849f6f13b30c031e4da80027c1e904d}{UltimateTicTacToeBoard}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_board_ae5dfded241ee3644196e2f6074d1d0b1}{Board}}<char>\ \{}
\DoxyCodeLine{00012\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00013\ \ \ \ \ \textcolor{keywordtype}{char}\ sub\_winners[3][3]\ =\ \{\ \{\textcolor{charliteral}{'\ '},\ \textcolor{charliteral}{'\ '},\ \textcolor{charliteral}{'\ '}\},\ \{\textcolor{charliteral}{'\ '},\ \textcolor{charliteral}{'\ '},\ \textcolor{charliteral}{'\ '}\},\ \{\textcolor{charliteral}{'\ '},\ \textcolor{charliteral}{'\ '},\ \textcolor{charliteral}{'\ '}\}\ \};}
\DoxyCodeLine{00014\ \ \ \ \ \textcolor{keywordtype}{int}\ last\_move\_x\ =\ -\/1,\ last\_move\_y\ =\ -\/1;}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keywordtype}{bool}\ check\_sub\_win(\textcolor{keywordtype}{int}\ subgrid\_row,\ \textcolor{keywordtype}{int}\ subgrid\_col,\ \textcolor{keywordtype}{char}\ symbol)\ \{}
\DoxyCodeLine{00017\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ start\_row\ =\ subgrid\_row\ *\ 3;}
\DoxyCodeLine{00018\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ start\_col\ =\ subgrid\_col\ *\ 3;}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ rows\ in\ subgrid}}
\DoxyCodeLine{00021\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \{}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ i][start\_col]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ i][start\_col\ +\ 1]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00024\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ i][start\_col\ +\ 2]\ ==\ symbol)}
\DoxyCodeLine{00025\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00026\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ columns\ in\ subgrid}}
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ 3;\ j++)\ \{}
\DoxyCodeLine{00030\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row][start\_col\ +\ j]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ 1][start\_col\ +\ j]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ 2][start\_col\ +\ j]\ ==\ symbol)}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ diagonals\ in\ subgrid}}
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row][start\_col]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ 1][start\_col\ +\ 1]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ 2][start\_col\ +\ 2]\ ==\ symbol)}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row][start\_col\ +\ 2]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ 1][start\_col\ +\ 1]\ ==\ symbol\ \&\&}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[start\_row\ +\ 2][start\_col]\ ==\ symbol)}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00048\ \ \ \ \ \}}
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keywordtype}{bool}\ check\_main\_win(\textcolor{keywordtype}{char}\ symbol)\ \{}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ rows\ in\ main\ grid}}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \{}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[i][0]\ ==\ symbol\ \&\&\ sub\_winners[i][1]\ ==\ symbol\ \&\&\ sub\_winners[i][2]\ ==\ symbol)}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00055\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ columns\ in\ main\ grid}}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ 3;\ j++)\ \{}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[0][j]\ ==\ symbol\ \&\&\ sub\_winners[1][j]\ ==\ symbol\ \&\&\ sub\_winners[2][j]\ ==\ symbol)}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00061\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ diagonals\ in\ main\ grid}}
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[0][0]\ ==\ symbol\ \&\&\ sub\_winners[1][1]\ ==\ symbol\ \&\&\ sub\_winners[2][2]\ ==\ symbol)}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[0][2]\ ==\ symbol\ \&\&\ sub\_winners[1][1]\ ==\ symbol\ \&\&\ sub\_winners[2][0]\ ==\ symbol)}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00070\ \ \ \ \ \}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00073\ \ \ \ \ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_a9849f6f13b30c031e4da80027c1e904d}{UltimateTicTacToeBoard}}()\ :\ \mbox{\hyperlink{class_board_ae5dfded241ee3644196e2f6074d1d0b1}{Board}}(9,\ 9)\ \{}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 9;\ i++)\ \{}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ 9;\ j++)\ \{}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i][j]\ =\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00079\ \ \ \ \ \}}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ac90792792e5a954ccca9534e1dba1d1d}{update\_board}}(\mbox{\hyperlink{class_move}{Move<char>}}*\ move)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x\ =\ move-\/>\mbox{\hyperlink{class_move_a9d4f543a81e361f872d37bcfb64d5b55}{get\_x}}();}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ y\ =\ move-\/>\mbox{\hyperlink{class_move_a96469802a55c9083a1e93c7edec8a00c}{get\_y}}();}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ symbol\ =\ move-\/>\mbox{\hyperlink{class_move_a595bf740852c05a1cb425ef2640fd4ff}{get\_symbol}}();}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (x\ <\ 0\ ||\ x\ >=\ 9\ ||\ y\ <\ 0\ ||\ y\ >=\ 9)\ \{}
\DoxyCodeLine{00087\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Invalid\ position!\ Use\ 0-\/8.\(\backslash\)n"{}};}
\DoxyCodeLine{00088\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00089\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ if\ move\ is\ in\ allowed\ subgrid}}
\DoxyCodeLine{00092\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (last\_move\_x\ !=\ -\/1\ \&\&\ last\_move\_y\ !=\ -\/1)\ \{}
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ target\_subgrid\_row\ =\ last\_move\_x\ \%\ 3;}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ target\_subgrid\_col\ =\ last\_move\_y\ \%\ 3;}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ current\_subgrid\_row\ =\ x\ /\ 3;}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ current\_subgrid\_col\ =\ y\ /\ 3;}
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[target\_subgrid\_row][target\_subgrid\_col]\ ==\ \textcolor{charliteral}{'\ '})\ \{}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Must\ play\ in\ specified\ subgrid\ unless\ it's\ won}}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (current\_subgrid\_row\ !=\ target\_subgrid\_row\ ||}
\DoxyCodeLine{00101\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ current\_subgrid\_col\ !=\ target\_subgrid\_col)\ \{}
\DoxyCodeLine{00102\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Must\ play\ in\ subgrid\ ("{}}\ <<\ target\_subgrid\_row}
\DoxyCodeLine{00103\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <<\ \textcolor{stringliteral}{"{},\ "{}}\ <<\ target\_subgrid\_col\ <<\ \textcolor{stringliteral}{"{})\(\backslash\)n"{}};}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00106\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[x][y]\ !=\ \textcolor{charliteral}{'\ '})\ \{}
\DoxyCodeLine{00110\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ \textcolor{stringliteral}{"{}Cell\ already\ occupied!\(\backslash\)n"{}};}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[x][y]\ =\ symbol;}
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_board_a5952baefabced65fecec333de638408d}{n\_moves}}++;}
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ if\ subgrid\ is\ won}}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ subgrid\_row\ =\ x\ /\ 3;}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ subgrid\_col\ =\ y\ /\ 3;}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[subgrid\_row][subgrid\_col]\ ==\ \textcolor{charliteral}{'\ '}\ \&\&}
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \ \ \ \ check\_sub\_win(subgrid\_row,\ subgrid\_col,\ symbol))\ \{}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \ \ \ \ sub\_winners[subgrid\_row][subgrid\_col]\ =\ symbol;}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Set\ next\ move\ target}}
\DoxyCodeLine{00126\ \ \ \ \ \ \ \ \ last\_move\_x\ =\ x;}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ last\_move\_y\ =\ y;}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00130\ \ \ \ \ \}}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ab3e0743c011368128d4c3e28a6eaca52}{is\_win}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ check\_main\_win(player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}());}
\DoxyCodeLine{00134\ \ \ \ \ \}}
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ab1b1ec64fc98d4886952ed83e94349d4}{is\_lose}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00138\ \ \ \ \ \}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ad37a16c0ed77f9fbc0f63b0508e73155}{is\_draw}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00141\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ if\ all\ subgrids\ are\ won\ or\ full}}
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 3;\ i++)\ \{}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ 3;\ j++)\ \{}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sub\_winners[i][j]\ ==\ \textcolor{charliteral}{'\ '})\ \{}
\DoxyCodeLine{00145\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Check\ if\ subgrid\ has\ empty\ cells}}
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ has\_empty\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ si\ =\ 0;\ si\ <\ 3;\ si++)\ \{}
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ sj\ =\ 0;\ sj\ <\ 3;\ sj++)\ \{}
\DoxyCodeLine{00149\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{class_board_af00c1fc363eb640ca276b8a572040040}{board}}[i\ *\ 3\ +\ si][j\ *\ 3\ +\ sj]\ ==\ \textcolor{charliteral}{'\ '})\ \{}
\DoxyCodeLine{00150\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ has\_empty\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00152\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00153\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00154\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (has\_empty)\ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00155\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00156\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (has\_empty)\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00157\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00158\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00159\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00160\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ !\mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ab3e0743c011368128d4c3e28a6eaca52}{is\_win}}(player);}
\DoxyCodeLine{00161\ \ \ \ \ \}}
\DoxyCodeLine{00162\ }
\DoxyCodeLine{00163\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ab5c54eeeb45c34556074df9eeed00ee2}{game\_is\_over}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ab3e0743c011368128d4c3e28a6eaca52}{is\_win}}(player)\ ||\ \mbox{\hyperlink{class_ultimate_tic_tac_toe_board_ad37a16c0ed77f9fbc0f63b0508e73155}{is\_draw}}(player);}
\DoxyCodeLine{00165\ \ \ \ \ \}}
\DoxyCodeLine{00166\ \};}
\DoxyCodeLine{00167\ }
\DoxyCodeLine{00168\ \textcolor{comment}{//\ Ultimate\ Player}}
\DoxyCodeLine{00169\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_ultimate_tic_tac_toe___player_a88c24eac90c892ee92ca9a5bc0424f22}{UltimateTicTacToe\_Player}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}<char>\ \{}
\DoxyCodeLine{00170\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00171\ \ \ \ \ \mbox{\hyperlink{class_ultimate_tic_tac_toe___player_a88c24eac90c892ee92ca9a5bc0424f22}{UltimateTicTacToe\_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{00172\ \};}
\DoxyCodeLine{00173\ }
\DoxyCodeLine{00174\ \textcolor{comment}{//\ Ultimate\ Random\ Player}}
\DoxyCodeLine{00175\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_ultimate_tic_tac_toe___random_player_aad9e845454683024686e3764618a209c}{UltimateTicTacToe\_RandomPlayer}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_player_adb4e803a7ac0356b111b8ca79d766976}{Player}}<char>\ \{}
\DoxyCodeLine{00176\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00177\ \ \ \ \ \mbox{\hyperlink{class_ultimate_tic_tac_toe___random_player_aad9e845454683024686e3764618a209c}{UltimateTicTacToe\_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{00178\ \ \ \ \ \ \ \ \ srand(time(0));}
\DoxyCodeLine{00179\ \ \ \ \ \}}
\DoxyCodeLine{00180\ \};}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ \textcolor{comment}{//\ Ultimate\ UI}}
\DoxyCodeLine{00183\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_ultimate_tic_tac_toe___u_i_a5dcbc77df33da04c615b992c05f9897f}{UltimateTicTacToe\_UI}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}<char>\ \{}
\DoxyCodeLine{00184\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00185\ \ \ \ \ \mbox{\hyperlink{class_ultimate_tic_tac_toe___u_i_a5dcbc77df33da04c615b992c05f9897f}{UltimateTicTacToe\_UI}}()\ :\ \mbox{\hyperlink{class_u_i_ae50eed41905ca2f8dc103d9bef427fe6}{UI}}(\textcolor{stringliteral}{"{}Welcome\ to\ Ultimate\ Tic-\/Tac-\/Toe!"{}},\ 3)\ \{\}}
\DoxyCodeLine{00186\ }
\DoxyCodeLine{00187\ \ \ \ \ \mbox{\hyperlink{class_move}{Move<char>}}*\ \mbox{\hyperlink{class_ultimate_tic_tac_toe___u_i_a4338a56b42da0f2b00ad0d0eb5659a92}{get\_move}}(\mbox{\hyperlink{class_player}{Player<char>}}*\ player)\textcolor{keyword}{\ override\ }\{}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (player-\/>\mbox{\hyperlink{class_player_a2df3bd299bf7aecfa2275ec6902a60f8}{get\_type}}()\ ==\ \mbox{\hyperlink{_board_game___classes_8h_abe590f3c9109f404f003d5d7e4f0fccfaa36c6719f4d3207d858cf956ef1e93b6}{PlayerType::HUMAN}})\ \{}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x,\ y;}
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ player-\/>\mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\ <<\ \textcolor{stringliteral}{"{}\ ("{}}\ <<\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}()}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <<\ \textcolor{stringliteral}{"{}),\ enter\ your\ move\ (row\ and\ column\ 0-\/8):\ "{}};}
\DoxyCodeLine{00192\ \ \ \ \ \ \ \ \ \ \ \ \ cin\ >>\ x\ >>\ y;}
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_move}{Move<char>}}(x,\ y,\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}());}
\DoxyCodeLine{00194\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00195\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00196\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ x\ =\ rand()\ \%\ 9;}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ y\ =\ rand()\ \%\ 9;}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ player-\/>\mbox{\hyperlink{class_player_aed2af19790ba73190e3ebeea589518e1}{get\_name}}()\ <<\ \textcolor{stringliteral}{"{}\ chooses\ position\ ("{}}\ <<\ x\ <<\ \textcolor{stringliteral}{"{},\ "{}}\ <<\ y\ <<\ \textcolor{stringliteral}{"{})\(\backslash\)n"{}};}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{class_move}{Move<char>}}(x,\ y,\ player-\/>\mbox{\hyperlink{class_player_af56f0bf98c0423a3a75b0848607d03a4}{get\_symbol}}());}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00201\ \ \ \ \ \}}
\DoxyCodeLine{00202\ \};}
\DoxyCodeLine{00203\ }
\DoxyCodeLine{00204\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ ULTIMATETICTACTOE\_H}}

\end{DoxyCode}
