SHOW:
|
|
- or go back to the newest paste.
1 | static void PontozasVizszintes(int[,] a) | |
2 | { | |
3 | ||
4 | int pontszam = 0; | |
5 | int doboz = 1; | |
6 | //int hely = 1; | |
7 | ||
8 | for(int i = 0; i < 6; i++) | |
9 | { | |
10 | for(int j = 0; j< 6-1; j++) | |
11 | { | |
12 | if(a[i,j] == a[i, j+1] ) | |
13 | ||
14 | { | |
15 | doboz++; | |
16 | Console.WriteLine(doboz); | |
17 | } | |
18 | } | |
19 | if (doboz == 3) { pontszam += doboz; Console.WriteLine(pontszam); Console.ReadKey() ; } | |
20 | else if (doboz == 4) {pontszam += 1 + doboz;Console.WriteLine(pontszam); Console.ReadKey();} | |
21 | else if (doboz == 5) { pontszam += 2 + doboz; Console.WriteLine(pontszam); Console.ReadKey(); } | |
22 | } | |
23 | ||
24 | - | /*for (int i = 0; i < a.GetLength(0); i++) |
24 | + | for (int i = 0; i < a.GetLength(0); i++) |
25 | { | |
26 | ||
27 | //for (int s = hely; s < a.GetLength(1)-1; s++) | |
28 | ||
29 | do | |
30 | { | |
31 | ||
32 | do | |
33 | { | |
34 | ||
35 | for (int j = hely; j < a.GetLength(1) - 1; j++) | |
36 | { | |
37 | ||
38 | if (a[i, j] == a[i, j + 1]) | |
39 | { | |
40 | doboz++; | |
41 | Console.WriteLine(doboz); | |
42 | } | |
43 | else | |
44 | { | |
45 | doboz = 1; | |
46 | Console.WriteLine(doboz); | |
47 | } | |
48 | //hely++; | |
49 | } | |
50 | hely++; | |
51 | } while (doboz < 2 || hely < a.GetLength(1) - 1); | |
52 | ||
53 | if (doboz == 3) pontszam += doboz; | |
54 | ||
55 | else if (doboz == 4) pontszam += 1; | |
56 | ||
57 | else if (doboz == 5) pontszam += 1; | |
58 | ||
59 | ||
60 | ||
61 | ||
62 | - | } while (hely < a.GetLength(1) - 1);*/ |
62 | + | } while (hely < a.GetLength(1) - 1); |
63 | ||
64 | //hely = 0; | |
65 | ||
66 | Console.WriteLine("Pontszám: " + pontszam); | |
67 | Console.ReadLine(); | |
68 | ||
69 | } |