-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
100 lines (68 loc) · 2.22 KB
/
Program.cs
File metadata and controls
100 lines (68 loc) · 2.22 KB
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
/*using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wolfram {
class Program {
static void Main (string [] args) {
Console.Write("Entrer la règle");
//int regle = Console.ReadLine();
//String masque = Convert.ToString(regle,2);
int [] ligne = new int [6];
Random r = new Random();
for (int i = 0 ; i < ligne.Length ; i++) {
if (r.NextDouble() > 0.5)
ligne [i] = 1;
else
ligne [i] = 0;
}
}
public static int calculVoisin(int deb, int pos, int[] l) {
int voisin;
if (deb == 1)
voisin = 1;
else
voisin = 0;
if(pos == 0) {
for(int i = pos + 1 ; i < 3 ; i++) {
if (l [i] == 1)
voisin++;
}
for(int j = l.Length ; j > l.Length-2 ; j--) {
if (l [j] == 1)
voisin++;
}
}
else {
if (pos == 1) {
for (int i = pos+1 ; i < 3 ; i++) {
if (l [i] == 1)
voisin++;
}
if (l [pos - 1] == 1)
voisin++;
for (int j = l.Length ; j > l.Length - 1 ; j--) {
if (l [j] == 1)
voisin++;
}
}
else {
for (int i = pos + 1 ; i < pos+3 ; i++) {
if (l [i] == 1)
voisin++;
}
for (int j = pos + 1 ; j > -1 ; j--) {
if (l [j] == 1)
voisin++;
}
}
}
return voisin;
}
public static void calculRegle (String regle, int[] ligne) {
//int regle = Console.ReadLine();
//String masque = Convert.ToString(regle,2);
}
}
}*/