-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuh_temp_algov1.0
88 lines (66 loc) · 2.29 KB
/
uh_temp_algov1.0
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
---------------------------
list_iteration2= generate_positions_around(list_response, magnification, list_iteration)
generate_positions_around(list_response, magnification){
list_iteration = []
for item in list_response:
list_iteration.add(int(item.x - magnification*width, item.y)
list_iteration.add(int(item.x + magnification*width, item.y)
list_iteration.add(int(item.x, item.y - magnification*height)
list_iteration.add(int(item.x, item.y + magnification*height)
list_iteration.add(int(item.x+magnification*width, item.y + magnification*height)
list_iteration.add(int(item.x+magnification*width, item.y - magnification*height)
list_iteration.add(int(item.x-magnification*width, item.y + magnification*height)
list_iteration.add(int(item.x-magnification*width, item.y - magnification*height)
return list_iteration
}
--------------------------
/*Create Matrix*/
Matrix1=Array[matrix_width][matrix_height]
step_size=20
Number_of_steps=matrix_width/step_size (integer)
/*create a set of x,y pairs for the first iteration*/
set_iteration1=
set_iteration2=null
flag_generate_position2=false /*flag to indicate whether positions for iteration 2 have been generated*/
/*initialization of display position*/
x_next=step_size-1
y_next=step_size-1
z_next=0
get_point(){
x_send=x_next
y_send=y_next
update_current_position() /*update x_next, y_next*/
return x_send, y_send
}
save_point(x,y,flag){
Matrix1[x][y]=flag
}
update_current_position() {
If set_iteration1 is not empty:
position= random(size of set_iteration1)
/*update x_next, y_next*/
x_next, y_next= set_iteration1[position]
remove item from set_iteration2
else:
if flag_generate_position2=false:
generate_iteration2_positions()
flag_generate_position2=true
position2= random(ize of set_iteration2)
/*update x_next, y_next*/
x_next, y_next= set_iteration2[position2]
remove item from set_iteration2
else:
position2= random(size of set_iteration2)
/*update x_next, y_next*/
x_next, y_next= set_iteration2[position2]
remove item from set_iteration2
}
generate_iteration2_positions(){
/*for scan through the matrix positions*/
for i in 0 to matrix_width:
for j in 0 to matrix_height:
if matrix1 [i] [j] ==true:
generate_positions_around(I,j)
}
generate_positions_around(i,j){
}