-
Notifications
You must be signed in to change notification settings - Fork 1
/
sudoku.java
62 lines (62 loc) · 1.86 KB
/
sudoku.java
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import java.util.Scanner;
public class sudoku
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("________SUDOKU________\n");
int size=0,dif=0;
while(true)
{
System.out.println("CHOOSE YOUR GAME MODE\n");
System.out.println("1. 4 X 4\n");
System.out.println("2. 9 X 9\n");
System.out.println("3. 16 X 16\n");
int c=sc.nextInt();
switch(c)
{
case 1:
size=4;
break;
case 2:
size=9;
break;
case 3:
size=16;
break;
default:
System.out.println("Invalid");
}
System.out.println("CHOOSE YOUR DIFFICULTY\n");
System.out.println("1. Easy\n");
System.out.println("2. Medium\n");
System.out.println("3. Hard\n");
c=sc.nextInt();
switch(c)
{
case 1:
dif=6;
break;
case 2:
dif=5;
break;
case 3:
dif=4;
break;
default:
System.out.println("Invalid");
}
if(size!=0 && dif!=0)
{
sudoku_gen gen=new sudoku_gen(size);
sudoku_game game=new sudoku_game(size,gen.gen(),dif);
game.game();
System.out.println("Play Again ?");
System.out.println("1.YES 2.NO");
if(!(sc.nextInt()==1))
break;
}
}
System.out.println("THANK YOU FOR PLAYING");
}
}