-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.one
146 lines (135 loc) · 2.7 KB
/
graph.one
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
// https://github.com/BaseMax/RamseyNumbers
// import time
// import file
// import bigInt
define SET_PAIR(item, first, end):
item.a=first
item.b=end
end
// type enum boolType:
// false,
// true,
// end
type struct pair:
int a
int b
end
type struct color:
int a
int b
uint c
end
int art
int count
int value
pair **items
color *edges
int edgesCount=0
int itemsCount=0
int subCount=10
// uint randomColor:
randomColor:
ret math.rand(count)
end
// uint found int i, int j:
found int i, int j:
repeat x, 0, edgesCount:
if
(edges[x].a == i && edges[x].b == j) ||
(edges[x].a == j && edges[x].b == i):
ret edges[x].c
end
end
ret -1
end
// int main:
main:
art=43
count=2
value=5// both is 3
__ "R(", value, ",", value, ") ?= ", art
////////////////////////////////////
items=memory.alloc(size(pair*)*962598)
int first_limit=100000
int first_limit_index=0
edges=malloc(size(color)*903)
edgesCount=0
repeat i, 0, art:
repeat j, i+1, art:
SET_PAIR(edges[edgesCount], i+1, j+1)
__ "edge: ", i+1, ",", j+1
edgesCount++
end
end
repeat i, 0, art:
repeat j, i+1, art:
repeat l, j+1, art:
repeat w, l+1, art:
repeat e, w+1, art:
items[itemsCount]=malloc(size(pair)*subCount)
SET_PAIR(items[itemsCount][0], i+1, j+1)
SET_PAIR(items[itemsCount][1], i+1, l+1)
SET_PAIR(items[itemsCount][2], i+1, w+1)
SET_PAIR(items[itemsCount][3], i+1, e+1)
SET_PAIR(items[itemsCount][4], j+1, l+1)
SET_PAIR(items[itemsCount][5], j+1, w+1)
SET_PAIR(items[itemsCount][6], j+1, e+1)
SET_PAIR(items[itemsCount][7], l+1, w+1)
SET_PAIR(items[itemsCount][8], l+1, e+1)
SET_PAIR(items[itemsCount][9], w+1, e+1)
itemsCount++
end
end
end
end
end
__ "===> itemsCount is ", itemsCount
pf = file.open("graph-result.txt", "a")
// while true:
while:
label check:
first_limit_index++
if first_limit_index > first_limit:
__ "END, Limit....."
sys.exit(-1)
end
__ first_limit_index, "/", first_limit
pf.appendLine(first_limit_index + "/" + first_limit)
repeat i, 0, edgesCount:
edges[i].c=randomColor()
end
bool sameColor=false
repeat i, 0, itemsCount:
bool checkContinue=true
uint color=-1
repeat j, 0, value:
if color == -1:
color=found(items[i][j].a, items[i][j].b)
continue
end
else:
uint tcolor=found(items[i][j].a, items[i][j].b)
if tcolor != color:
checkContinue=false
break
end
end
end
// if checkContinue == true:
if checkContinue:
sameColor=true
__ "===>", i
pf.appendLine(i)
goto check
end
end
// if sameColor == false:
if !sameColor:
__ "Done"
sys.exit(1)
end
end
pf.close()
__ itemsCount
ret 0
end