-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.bb
39 lines (31 loc) · 872 Bytes
/
example.bb
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
Include "binaryheaps.bb"
Graphics 800,600,16,2
BinID% = BinaryHeap_New%(BinaryHeap_SORT_BIGGEST)
BinID2% = BinID
BinaryHeap_Draw(BinID,0, 4)
SeedRnd MilliSecs()
While Not KeyHit(1)
valor = Rand(1,500)
If KeyDown(2) Then
time = MilliSecs()
BinaryHeap_Add%(BinID,valor,valor)
DebugLog "Tempo: "+(MilliSecs()-time)
EndIf
If KeyHit(3) Then
time = MilliSecs()
DebugLog "Remove: "+BinaryHeap_Remove%(BinID)
DebugLog "Tempo: "+(MilliSecs()-time)
EndIf
If KeyHit(4) Then
valor% = Int(Input("mudar >"))
BinaryHeap_Modify%(BinID, valor%,valor,666)
DebugLog "Modify"
EndIf
If KeyHit(5) Then
BinID% = BinaryHeap_New%(BinaryHeap_SORT_BIGGEST)
DebugLog "Add New"+BinID%
EndIf
If KeyHit(71) Then BinID = BinID + 1: DebugLog "Subiu: "+BinID%
If KeyHit(75) Then BinID = BinID - 1: DebugLog "Desceu: "+BinID%
BinaryHeap_Draw(BinID,0, 0)
Wend