\hypertarget{invader_grids_8cpp_source}{}\doxysection{invader\+Grids.\+cpp} \label{invader_grids_8cpp_source}\index{src/invaderGrids.cpp@{src/invaderGrids.cpp}} \mbox{\hyperlink{invader_grids_8cpp}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00001}00001 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00011}00011 \textcolor{preprocessor}{\#include}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00012}00012 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{invaders_grid_8h}{invadersGrid.h}}"{}}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00013}00013 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00014}\mbox{\hyperlink{class_invaders_column_ac21ea06c4b99ae790c5f69b0b70986be}{00014}} \textcolor{keywordtype}{bool} \mbox{\hyperlink{class_invaders_column_ac21ea06c4b99ae790c5f69b0b70986be}{InvadersColumn::hasNoValid}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00015}00015 \textcolor{keywordflow}{return} \mbox{\hyperlink{class_invaders_column_a712fad2377c0113268e94d4c90f688ec}{getOutterInvader}}()==size();} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00016}00016 \}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00017}00017 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00018}\mbox{\hyperlink{class_invaders_column_a712fad2377c0113268e94d4c90f688ec}{00018}} \textcolor{keywordtype}{unsigned} \mbox{\hyperlink{class_invaders_column_a712fad2377c0113268e94d4c90f688ec}{InvadersColumn::getOutterInvader}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00019}00019 \textcolor{keywordtype}{unsigned} i=size();} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00020}00020 \textcolor{keywordflow}{while}(i>0)\{} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00021}00021 -\/-\/i;} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00022}00022 \textcolor{keywordflow}{if}(at(i)!=\mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}})\textcolor{keywordflow}{return} i;} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00023}00023 \}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00024}00024 \textcolor{keywordflow}{return} size();} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00025}00025 \}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00026}00026 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00027}00027 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00028}00028 \textcolor{comment}{// these are used to invoke rand() as less as possible}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00029}00029 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00030}\mbox{\hyperlink{class_invaders_column_a098a2125b23fd3f7db24920cf173f35e}{00030}} \textcolor{keywordtype}{unsigned} \mbox{\hyperlink{class_invaders_column_a098a2125b23fd3f7db24920cf173f35e}{InvadersColumn::randomValidInv}}()\textcolor{keyword}{ const }\{} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00031}00031 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00032}00032 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00033}00033 \textcolor{keywordtype}{unsigned} validTotal = 0;} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00034}00034 \textcolor{keywordflow}{for}(\mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018}{InvaderType}} ite : *\textcolor{keyword}{this})\{} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00035}00035 \textcolor{keywordflow}{if}(ite!=\mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}})++validTotal;} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00036}00036 \}} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00037}00037 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00038}00038 \textcolor{keywordtype}{unsigned} rd = rand() \% validTotal;} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00039}00039 } \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00040}00040 \textcolor{keywordtype}{unsigned} validIndex = 0;} \DoxyCodeLine{\Hypertarget{invader_grids_8cpp_source_l00041}00041 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{unsigned} i=0;i