Skip to content

Commit 3403323

Browse files
committed
Add ANSI Color Escape Sequences
Added ANSI colors to brighten up the terminal a little bit. It looked good actually. Need to see what it looks like on a white terminal.
1 parent 4f76e34 commit 3403323

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Sudoku-Solver/sudoku-solver.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,33 +213,34 @@ class SudokuFrame{
213213
}
214214

215215
/**
216-
* @desc Displays the values stored in the frame with designs.
216+
* @desc Displays the values stored in the frame with designs. We also use
217+
* ANSI colors, using escape sequences, to display the frame.
217218
* @param none
218219
* @return none
219220
*/
220221
public:void displayFrame(){
221222

222-
cout<<"++=====================================++";
223+
cout<<"\033[0;36m++=====================================++";
223224
int rowIter, colIter;
224225

225226
for(rowIter=0; rowIter<9; rowIter++){
226227
int cellIter=1;
227228

228-
cout<<"\n||";
229+
cout<<"\n\033[0;36m||";
229230
for(colIter=0; colIter<9; colIter++){
230231
if(cellIter==3){
231-
cout<<" "<<sudokuFrame[rowIter][colIter]<<" ";
232-
cout<<"||";
232+
cout<<"\033[0m "<<sudokuFrame[rowIter][colIter]<<" ";
233+
cout<<"\033[0;36m||";
233234
cellIter=1;
234235
}
235236
else{
236-
cout<<" "<<sudokuFrame[rowIter][colIter]<<" ";
237+
cout<<"\033[0m "<<sudokuFrame[rowIter][colIter]<<" ";
237238
cellIter++;
238239
}
239240
}
240241

241-
if(rowIter%3!=2) cout<<"\n++-----------++-----------++-----------++";
242-
else cout<<"\n++=====================================++";
242+
if(rowIter%3!=2) cout<<"\n\033[0;36m++-----------++-----------++-----------++";
243+
else cout<<"\n\033[0;36m++=====================================++";
243244
}
244245

245246
}

0 commit comments

Comments
 (0)