-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass__MiningProcess.ahk
More file actions
111 lines (94 loc) · 1.95 KB
/
class__MiningProcess.ahk
File metadata and controls
111 lines (94 loc) · 1.95 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
101
102
103
104
105
106
107
108
109
110
111
;Hago diferentes operaciones sobre las rocas.
;El manejador de rocas tiene varias funciones para operar con rocas.
;_rockCollecton.next devuelve la posición de roca que esta un paso adelante de la actual.
;_cockCollection.moveToNext cambia la roca actual a la siguiente posicion.
;mining logic o _Logic
class _MiningProcess{
__New(array,ini:=1){
if (this.count := this.max := array.count()){
this.pointerAtCurrent := ini
this.pointer := ini
this.collection := array
this.min := ini
this.exist := true
this.nextWithMineralExist := false
this.pointerAtNextRockWithMineral := 0
}else{
this.exist := false
}
}
current[v:=-1]{
get{
if v = -1
return this.collection[pointerAtCurrent]
else
return ""
}
set{
throw "Error"
return ""
}
}
nextWithMineralExist[]{
get{
if this.isThereNextWithMineral()
return true
else
return false
}
set{
throw "Error"
return ""
}
}
nextWithMineral[v:=-1]{
get{
if v = -1
return this.collection[pointerAtNextRockWithMineral]
}
set{
throw "Error"
return ""
}
}
next[]{
get{
if (this.pointerAtCurrent < this.max)
return (this.pointerAtCurrent+1)
else if (this.pointerAtCurrent = this.max)
return this.min
}
set{
throw "Error"
return ""
}
}
isThereNextWithMineral(){
this.pointer := this.next
loop, % this.count {
if (!this.array[this.pointer].indicador.cambio()){
this.pointerAtNextRockWithMineral := this.pointer
return true
}
this.nextPointer()
}
this.pointerAtNextRockWithMineral := 0
return 0
}
nextPointer(){
if (this.pointer < this.max)
this.pointer++
else if this.pointer = this.max
this.pointer := this.min
}
goNext(){
if (this.pointerAtCurrent < this.max)
this.pointerAtCurrent++
else if this.pointerAtCurrent = this.max
this.pointerAtCurrent := this.min
}
random(){
Random, temp, this.min, this.max
this.pointerAtCurrent := temp
}
}