-
Notifications
You must be signed in to change notification settings - Fork 0
/
BasicSudokuPrinter.cs
44 lines (43 loc) · 961 Bytes
/
BasicSudokuPrinter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Globalization;
namespace Sudoku
{
public class BasicSudokuPrinter : ISudokuPrinter
{
public void Print(Sudoku sudoku)
{
Console.Write("+");
for (int i = 0; i < sudoku.SqrtMaxValue; i++)
{
for (int j = 0; j < sudoku.SqrtMaxValue; j ++)
{
Console.Write("-");
}
Console.Write("+");
}
Console.Write("\n");
for (int i = 0; i < sudoku.Values.Count; i++)
{
if ( i % sudoku.SqrtMaxValue == 0 ) Console.Write("|");
Console.Write(sudoku.Values[i]);
if ( (i+1) % sudoku.MaxValue == 0 ) Console.Write("|\n");
if ( (i+1) % sudoku.SecRowCount == 0 )
{
Console.Write("+");
for (int j = 0; j < sudoku.SqrtMaxValue; j++)
{
for (int k = 0; k < sudoku.SqrtMaxValue; k++)
{
Console.Write("-");
}
Console.Write("+");
}
Console.Write("\n");
}
}
}
}
}