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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
|
import java.util.Scanner;
import java.io.*;
public class Solver
{
public int[][] puzzle;
public Constraint[] constraints;
public int size;
public Solver(String filename)
{
parsePuzzle(filename);
/*puzzle = new int[3][3];
constraints = new Constraint[5];
Position[] p1 = new Position[1];
p1[0] = new Position(0,0);
constraints[0] = new Constraint(3," ",p1);
Position[] p2 = new Position[2];
p2[0] = new Position(1,0);
p2[1] = new Position(1,1);
constraints[1] = new Constraint(6,"*",p2);
Position[] p3 = new Position[2];
p3[0] = new Position(2,0);
p3[1] = new Position(2,1);
constraints[2] = new Constraint(2,"/",p3);
Position[] p4 = new Position[2];
p4[0] = new Position(0,1);
p4[1] = new Position(0,2);
constraints[3] = new Constraint(2,"/",p4);
Position[] p5 = new Position[2];
p5[0] = new Position(1,2);
p5[1] = new Position(2,2);
constraints[4] = new Constraint(2,"-",p5);
size = puzzle.length;
*/
System.out.println("Everything parsed, data is:");
System.out.println("Puzzle:");
printArray(puzzle);
System.out.println("Constraints:");
printArray(constraints);
System.out.println("size: " + size);
}
private void parsePuzzle(String filename)
{
Scanner s = null;
try
{
s = new Scanner(new FileInputStream(filename));
}
catch (Exception e)
{
System.out.println("Something went terribly wrong!\n" + e);
}
size = Integer.parseInt(s.nextLine().replaceAll("\n",""));
puzzle = new int[size][size];
constraints = new Constraint[Integer.parseInt(s.nextLine().replaceAll("\n",""))];
//System.out.println("Puzzle size: " + size + " Cages: " + p.length);
for(int i = 0; s.hasNextLine();i++)
{
String t1 = s.nextLine();
System.out.println("Praseing: " + t1);
String[] t2 = t1.split(",");
System.out.println("Parts length: " + t2.length);
if(t2.length > 1)
{
Position[] allcells = new Position[Integer.parseInt(t2[2])];
for(int j = 0; j < Integer.parseInt(t2[2]);j++)
{
String[] coords = s.nextLine().split(",");
allcells[j] = new Position(Integer.parseInt(coords[1]),Integer.parseInt(coords[0]));
}
constraints[i] = new Constraint(Integer.parseInt(t2[0]),t2[1],allcells);
System.out.println("Created new constraint(" + Integer.parseInt(t2[0]) + "," + t2[1] + ",");
printArray(allcells);
/*
for(Position c : allcells)
{
constraints[i] = new Constraint(Integer.parseInt(t2[0]),t2[1],allcells);
}
*/
//p[i] = new KCage(Integer.parseInt(t2[0]),getOp(t2[1]),allcells);
//System.out.println("Created " + p[i]);
}
}
}
public void put(int x, int y, int num)
{
puzzle[x][y] = num;
}
public int remove(int x, int y)
{
int num = puzzle[x][y];
puzzle[x][y] = 0;
return num;
}
public boolean[] getPossibilities(int x, int y)
{
boolean[] row = getPossibilitiesByRow(y);
boolean[] col = getPossibilitiesByCol(x);
boolean[] cage = getPossibilitiesByCage(x,y);
boolean[] output = new boolean[size];
System.out.println("By row:");
printArray(row);
System.out.println("By col:");
printArray(col);
System.out.println("By cage:");
printArray(cage);
for(int i = 0; i < size; i++)
{
if(row[i] && col[i] && cage[i])
{
output[i] = true;
}
}
System.out.println("Possibilities for (" + x + "," + y + ") are ");
printArray(output);
return output;
}
public boolean[] getPossibilitiesByRow(int row)
{
boolean[] possibs = new boolean[size];
for(int j = 0; j < size; j++)
{//Set all places is possibs to true
possibs[j] = true;
}
//Find all the possibilities
for(int j = 0; j < size; j++)
{ //For every other place
if(puzzle[j][row] != 0)
{
//System.out.println("Setting (" + j + "," + row + "): " + puzzle[j][row] + " to false");
possibs[puzzle[j][row]-1] = false;
}
}
return possibs;
}
public boolean[] getPossibilitiesByCol(int col)
{
boolean[] possibs = new boolean[size];
for(int j = 0; j < size; j++)
{//Set all places is possibs to true
possibs[j] = true;
}
//Find all the possibilities
for(int j = 0; j < size; j++)
{ //For every other place
if(puzzle[col][j] != 0)
{
//System.out.println("Setting (" + col + "," + j + "): " + puzzle[col][j] + " to false");
possibs[puzzle[col][j]-1] = false;
}
}
return possibs;
}
public boolean[] getPossibilitiesByCage(int x, int y)
{
//System.out.println("Finding cage possibilities on (" + x + "," + y + ")");
for(Constraint c : constraints)
{
//System.out.println("Testing a constraint: " + c.op);
for(Position p : c.positions)
{
//System.out.println("Found a position in this constraint: (" + p.x + "," + p.y + ")");
if(p.x == x && p.y == y)
{
System.out.println("Found cell being talked about.");
//We found the cage that's being talked about
if(c.op.equals("+"))
{
System.out.println("Found op: +");
return getPossibilitiesByCageAdd(c);
}
else if(c.op.equals("-"))
{
System.out.println("Found op: -");
return getPossibilitiesByCageSub(c);
}
else if(c.op.equals("*"))
{
System.out.println("Found op: *");
return getPossibilitiesByCageMul(c);
}
else if(c.op.equals("/"))
{
System.out.println("Found op: /");
return getPossibilitiesByCageDiv(c);
}
else if(c.op.equals(" "))
{
System.out.println("Found op: (NONE)");
boolean[] output = new boolean[size];
output[c.targNumber-1] = true;
//System.out.println("Returning:");
//printArray(output);
return output;
}
else
{
System.out.println("Bad operator: (" + c.op + ")");
return null;
}
}
}
}
System.out.println("Something has gone wrong in getPossibilitiesByCage");
return null;
}
private boolean[] getPossibilitiesByCageAdd(Constraint c)
{
System.out.println("Getting possibilities for add cage");
//Try the numbers 1 to size for every square
boolean[] output = new boolean[size];
int targ = c.targNumber;
//If any of the numbers are already in, subtract them from targ
for(Position p : c.positions)
{
targ -= puzzle[p.x][p.y];
}
//possibilities are targnumber - 1*# of positions to fill
int numcells = c.positions.length;
int max = targ - numcells;
int min = 1;
for(int i = min; i < max; i++)
{
output[i-1] = true;
}
return output;
}
private boolean[] getPossibilitiesByCageMul(Constraint c)
{
//Numbers can be from 1 to size for this one
//If the target number is odd, only an odd* an odd will work
int targ = c.targNumber;
System.out.println("Getting mul cage possibs:");
System.out.println("Cage: (" + c.targNumber + "," + c.op);
printArray(c.positions);
//If any of the numbers are already in, divide the target by that.
for(Position p : c.positions)
{
if(puzzle[p.x][p.y] != 0)
{
System.out.println("Found a number, useing division shortcut");
targ /= puzzle[p.x][p.y];
}
}
boolean[] output = new boolean[size];
if(c.targNumber % 2 == 1)
{
System.out.println("Found an odd number, useing odd numbers shortcut");
for(int i = 1; i < size+1; i+= 2)
{
System.out.println("Setting " + i + " to true");
output[i-1] = true;
}
System.out.println("Returning ");
printArray(output);
return output;
}
for(int i = 1; i < size+1; i++)
{
output[i-1] = true;
}
return output;
}
private boolean[] getPossibilitiesByCageSub(Constraint c)
{
//If one of the items is already in it, find what the other value must be
boolean[] output = new boolean[size];
int x1 = c.positions[0].x;
int y1 = c.positions[0].y;
int x2 = c.positions[1].x;
int y2 = c.positions[1].y;
if(puzzle[x1][y1] != 0)
{
int onlypossib = 0;
if(c.targNumber > puzzle[x1][y1])
{
onlypossib = c.targNumber-puzzle[x1][y1];
}
else if(c.targNumber < puzzle[x1][y1])
{
onlypossib = puzzle[x1][y1] - c.targNumber;
}
output[onlypossib-1] = true;
return output;
}
if(puzzle[x2][y2] != 0)
{
int onlypossib = 0;
if(c.targNumber>puzzle[x2][y2])
{
onlypossib = c.targNumber-puzzle[x2][y2];
}
else if(c.targNumber < puzzle[x2][y2])
{
onlypossib = puzzle[x2][y2] - c.targNumber;
}
output[onlypossib-1] = true;
return output;
}
//Otherwise, values can be from 1 to targnumber - 2
for(int i = 1; i < c.targNumber-2; i++)
{
output[i-1] = true;
}
return output;
}
private boolean[] getPossibilitiesByCageDiv(Constraint c)
{
//If one of the items is already in it, find what the other value must be
boolean[] output = new boolean[size];
int x1 = c.positions[0].x;
int y1 = c.positions[0].y;
int x2 = c.positions[1].x;
int y2 = c.positions[1].y;
if(puzzle[x1][y1] != 0)
{
int onlypossib = c.targNumber/puzzle[x1][y1];
output[onlypossib-1] = true;
return output;
}
if(puzzle[x2][y2] != 0)
{
int onlypossib = c.targNumber/puzzle[x2][y2];
output[onlypossib-1] = true;
return output;
}
//Otherwise, values can be from 1 to targnumber
for(int i = 1; i < c.targNumber+1; i++)
{
output[i-1] = true;
}
return output;
}
public boolean isSolved()
{
boolean tr = testRows();
boolean tc = testCols();
boolean ta = testCages();
System.out.println("Checking for solution(Rows: " + tr + ")(Cols: " + tc + ")(Cages: " + ta+"):");
printArray(puzzle);
if(!testRows() || !testCols() || !testCages())
{
return false;
}
return true;
}
private boolean testCages()
{
for(Constraint c : constraints)
{
if(!testConstraint(c))
{
return false;
}
}
return true;
}
private boolean testConstraint(Constraint c)
{
if(c.op.equals("+"))
{
int sum = 0;
for(Position p : c.positions)
{
if(puzzle[p.x][p.y] != 0)
{
sum += puzzle[p.x][p.y];
}
else
{
return false;
}
}
if(sum == c.targNumber)
{
return true;
}
else
{
System.out.println("Failed on constraint:("+c.targNumber+","+c.op+",");
printArray(c.positions);
return false;
}
}
else if(c.op.equals("-"))
{
Position p1 = c.positions[0];
Position p2 = c.positions[1];
if(puzzle[p1.x][p1.y] != 0 && puzzle[p2.x][p2.y] != 0)
{
int num1 = puzzle[p1.x][p1.y];
int num2 = puzzle[p2.x][p2.y];
if(num1 - num2 == c.targNumber)
{
return true;
}
if(num2 - num1 == c.targNumber)
{
return true;
}
}
else
{
System.out.println("Failed on constraint:("+c.targNumber+","+c.op+",");
printArray(c.positions);
return false;
}
return false;
}
else if(c.op.equals("*"))
{
int product = 1;
for(Position p : c.positions)
{
if(puzzle[p.x][p.y] != 0)
{
product *= puzzle[p.x][p.y];
}
else
{
return false;
}
}
if(product == c.targNumber)
{
return true;
}
else
{
System.out.println("Failed on constraint:("+c.targNumber+","+c.op+",");
printArray(c.positions);
System.out.println("Product is " + product);
return false;
}
}
else if(c.op.equals("/"))
{
Position p1 = c.positions[0];
Position p2 = c.positions[1];
if(puzzle[p1.x][p1.y] != 0 && puzzle[p2.x][p2.y] != 0)
{
double num1 = puzzle[p1.x][p1.y];
double num2 = puzzle[p2.x][p2.y];
if(num1 / num2 == c.targNumber)
{
return true;
}
if(num2 / num1 == c.targNumber)
{
return true;
}
}
else
{
System.out.println("Failed on constraint:("+c.targNumber+","+c.op+",");
printArray(c.positions);
return false;
}
return false;
}
else if(c.op.equals(" "))
{
int x = c.positions[0].x;
int y = c.positions[0].y;
if(puzzle[x][y] == c.targNumber)
{
return true;
}
else
{
return false;
}
}
System.out.println("Something went wrong in testConstraint");
return false;
}
private boolean testCols()
{
for(int i = 0; i < size; i++)
{
boolean[] uniqueCols = new boolean[size];
for(int j = 0; j < size; j++)
{
if(puzzle[i][j] == 0)
{
return false;
}
uniqueCols[puzzle[i][j]-1] = true;
}
for(int j = 0; j < uniqueCols.length; j++)
{
if(!uniqueCols[j])
{
return false;
}
}
}
//System.out.println("Something went wrong in testCols!");
return true;
}
private boolean testRows()
{
for(int i = 0; i < size; i++)
{
boolean[] uniqueRows = new boolean[size];
for(int j = 0; j < size; j++)
{
if(puzzle[j][i] == 0)
{
return false;
}
uniqueRows[puzzle[j][i]-1] = true;
}
for(int j = 0; j < uniqueRows.length; j++)
{
if(!uniqueRows[j])
{
return false;
}
}
}
//System.out.println("Something went wrong in testRows");
return true;
}
public int[][] implyByRows()
{
//System.out.println("Implying by rows...");
int[][][] output = new int[size][4][size];
int numImplyed = 0;
for(int i = 0; i < size; i++)
{
//System.out.println("Calling imply row helper on row " + i);
output[i] = implyByRowsHelper(i);
if(output[i].length > 0)
{
numImplyed++;
}
}
int[][] realoutput = new int[numImplyed][4];
int j = 0;
for(int i = 0; i < numImplyed;i++)
{
if(output[i].length > 0)
{
realoutput[j] = output[i][0];
j++;
}
}
return realoutput;
}
public int[][] implyByCols()
{
//System.out.println("Implying by cols...");
int[][][] output = new int[size][4][size];
int numImplyed = 0;
for(int i = 0; i < size; i++)
{
//System.out.println("Calling imply col helper on col " + i);
output[i] = implyByColsHelper(i);
if(output[i].length > 0)
{
numImplyed++;
}
}
int[][] realoutput = new int[numImplyed][4];
int j = 0;
for(int i = 0; i < numImplyed;i++)
{
if(output[i].length > 0)
{
realoutput[j] = output[i][0];
j++;
}
}
return realoutput;
}
public int[][] implyByCages()
{
//System.out.println("Implying by cages");
int[][][][] output = new int[size][size][4][size];
int numImplyed = 0;
//We should only be implying ONE number max!
for(int x = 0; x < size; x++)
{
for(int y = 0; y < size; y++)
{
//Scan for a num that has only 1 possibility
output[x][y] = implyByCagesHelper(x,y);
//System.out.println("Attempted to imply by cages on (" + x + "," + y + "):");
//printArray(output[x][y]);
if(output[x][y].length == 1)
{
//numImplyed++;
//System.out.println("Implything by cage. returning:");
//printArray(output[x][y]);
return output[x][y];
}
else
{
//System.out.println("Unable to imply");
}
}
}
//System.out.println("Unable to imply ANYTHING");
int[][] realoutput = new int[0][0];
return realoutput;
/*
int[][] realoutput = new int[1][4];
int track = 0;
if(output.length == 1)
{
realoutput[0] = output[x][y][0];
return realoutput;
}
*/
}
public int[][] implyByCagesHelper(int x, int y)
{
int[][] realoutput = new int[size][4];
//System.out.println("Implying on cage(" + x + "," + y + ")");
int[][] output = new int[size][4];
if(puzzle[x][y] != 0)
{
//This square already has a number in it.
}
else
{
boolean[] possibs = getPossibilitiesByCage(x,y);
//System.out.println("Got possibilities:");
//printArray(possibs);
int j = 0;
int numtrue = 0;
for(boolean b : possibs)
{
if(b)
{
numtrue++;
}
}
if(numtrue == 1)
{
for(int i = 0; i < possibs.length;i++)
{
if(possibs[i])
{
realoutput = new int[1][4];
puzzle[x][y] = i+1;
realoutput[j][0] = 0;
realoutput[j][1] = x;
realoutput[j][2] = y;
realoutput[j][3] = i;
return realoutput;
}
}
}
}
return realoutput;
}
private int[][] implyByRowsHelper(int row)
{
//System.out.println("Implying on row " + row);
//boolean[] places = new boolean[size];
//Outputs all numbers that should go on the stack, each number is in the form (0,x,y,num)
//this method may output more than 1 implyed number.
int[][] output = new int[size][4];
int numImplyed = 0;
for(int i = 0; i < size; i++)
{ //For each square
//This place already has something
if(puzzle[i][row] != 0)
{
//System.out.println("(" + i + "," + row + ") already has " + puzzle[i][row]);
}
else
{
boolean[] possibs = getPossibilitiesByRow(row);
//System.out.println("Possibilities for (" + i + "," + row + ") are:");
printArray(possibs);
//Find out how many possibilites for this place is true
int numtrue = 0;
int lasttrue = 0;
for(int j = 0; j < size;j++)
{
if(possibs[j])
{
numtrue++;
lasttrue = j+1;
}
}
if(numtrue == 1)
{
puzzle[i][row] = lasttrue;
output[numImplyed][0] = 0;
output[numImplyed][1] = i;
output[numImplyed][2] = row;
output[numImplyed][3] = lasttrue;
numImplyed++;
}
}
}
//System.out.println("First output is : ");
//printArray(output);
int[][] realoutput = new int[numImplyed][4];
for(int i = 0; i < numImplyed; i++)
{
realoutput[i] = output[i];
}
//System.out.println("Real output is : ");
//printArray(realoutput);
return realoutput;
}
private int[][] implyByColsHelper(int col)
{
// System.out.println("Implying on row " + row);
//boolean[] places = new boolean[size];
//Outputs all numbers that should go on the stack, each number is in the form (0,x,y,num)
//this method may output more than 1 implyed number.
int[][] output = new int[size][4];
int numImplyed = 0;
for(int i = 0; i < size; i++)
{ //For each square
//This place already has something
if(puzzle[col][i] != 0)
{
//System.out.println("(" + i + "," + row + ") already has " + puzzle[i][row]);
}
else
{
boolean[] possibs = getPossibilitiesByCol(col);
//System.out.println("Possibilities for (" + col + "," + i + ") are:");
//printArray(possibs);
//Find out how many possibilites for this place is true
int numtrue = 0;
int lasttrue = 0;
for(int j = 0; j < size;j++)
{
if(possibs[j])
{
numtrue++;
lasttrue = j+1;
}
}
if(numtrue == 1)
{
puzzle[col][i] = lasttrue;
output[numImplyed][0] = 0;
output[numImplyed][1] = col;
output[numImplyed][2] = i;
output[numImplyed][3] = lasttrue;
numImplyed++;
}
}
}
//System.out.println("First output is : ");
//printArray(output);
int[][] realoutput = new int[numImplyed][4];
for(int i = 0; i < numImplyed; i++)
{
realoutput[i] = output[i];
}
//System.out.println("Real output is : ");
//printArray(realoutput);
return realoutput;
}
public void printPuzzle()
{
for(int y = 0; y < puzzle.length; y++)
{
for(int x = 0; x < puzzle[y].length; x++)
{
System.out.print(puzzle[x][y] + " ");
}
System.out.print("\n");
}
}
public void printArray(int[] arr)
{
if(arr.length == 0)
{
System.out.println("[]");
return;
}
System.out.print("[" + arr[0]);
for(int i = 1; i < arr.length; i++)
{
System.out.print("," + arr[i]);
}
System.out.print("]\n");
}
public void printArray(int[][] arr)
{
if(arr.length == 0)
{
System.out.println("[[]]");
return;
}
System.out.print("[\t");
printArray(arr[0]);
for(int i = 1; i < arr.length; i++)
{
System.out.print("\t");
printArray(arr[i]);
}
System.out.print("]\n");
}
public void printArray(boolean[] arr)
{
if(arr.length == 0)
{
System.out.println("[]");
return;
}
System.out.print("[" + arr[0]);
for(int i = 1; i < arr.length; i++)
{
System.out.print("," + arr[i]);
}
System.out.print("]\n");
}
public void printArray(Position[] arr)
{
if(arr.length == 0)
{
System.out.println("[]");
return;
}
System.out.print("[(" + arr[0].x + "," + arr[0].y + ")");
for(int i = 1; i < arr.length; i++)
{
System.out.print(",(" + arr[i].x + "," + arr[i].y + ")");
}
System.out.print("]\n");
}
public void printArray(Constraint[] arr)
{
if(arr.length == 0)
{
System.out.println("[[]]");
return;
}
System.out.print("[\t");
printArray(arr[0]);
for(int i = 1; i < arr.length; i++)
{
System.out.print("\t");
printArray(arr[i]);
}
System.out.print("]\n");
}
public void printArray(Constraint c)
{
System.out.print("(" + c.op + "," + c.targNumber + ",");
printArray(c.positions);
}
}
|