Извините, ничего не найдено.

Не расстраивайся! Лучше выпей чайку!
Регистрация
Справка
Календарь

Вернуться   forum.boolean.name > Программирование игр для компьютеров > Blitz3D > Полезные функции

Полезные функции Выкладываем полезные функции, чтоб не изобретать велосипед заново...

Ответ
 
Опции темы
Старый 21.03.2025, 14:45   #1
polopok
Знающий
 
Регистрация: 17.07.2009
Сообщений: 201
Написано 53 полезных сообщений
(для 75 пользователей)
LinkedList

LinkedList - двенаправленные списки LinkedList exemple.rar
Возможно кому-то пригодится
__________________
Мой проект здесь
(Offline)
 
Ответить с цитированием
Старый 08.04.2025, 19:50   #2
polopok
Знающий
 
Регистрация: 17.07.2009
Сообщений: 201
Написано 53 полезных сообщений
(для 75 пользователей)
Ответ: LinkedList

Обновлённый "двунаправленный список" LinkedList.rar


Тест код в оффтоп:
Include "LinkedList.bb"

Graphics 800,600,32,2
SetBuffer BackBuffer
()
fntArial LoadFont("Arial",20
SetFont fntArial 

    Type Point
        Field x
#, y#
    
End Type
    
    p
.Point Object.PointHandle( New Point)) ; Object <- Handle
    p
\200
    p
\160

    all_node 
False
    positive_negative 
False 
    free_Node_ID 
0
    free_List_ID 
0
    num 
0
    
    n
.Node Null
    
    t1
.List = NewList(" t1 ")
    
Pusht1Null"Push", -1Handlep)) ; Handlep)
    
Pusht1Null"push 2"0)
    
    
num num 3
    Push
t1Null"pusH " num0.2)
    
    
DelByIndex(t12)
    
    
UnShiftt1Null"unShift"33)
    ;
UnShiftt1Null"unShift 2"7)
    ;
UnShiftt1Null"unShift 3"12)
    
    
InsertListt1NewNode"Insert"67), 2)
    
    
NewNode"newNode 3")
    
n\list = NewList(" g ") ; : If n\list <> Null Then DebugLog "n\list = Try" Else DebugLog "n\list = None"
    
InsertListt1n3)
    ;
nodeByTextt1"newNode 3") : If n\list <> Null Then DebugLog "n\list = Try" Else DebugLog "n\list = None"



    
t.List = NewList("S")
        
PushtNull"S_push"0.75)
        
PushtNull"S_push 2", -11)
        
PushtNull"S_push 2"0Handlet1)) ; Handlet1)
    
n1.Node NewNode"", -5)
        
n1\list = t
    InsertList
t1n1t1\totalNode
    
    
tt.List = NewList("S")
        
PushttNull"S_push"0.75)
        
PushttNull"S_push 2", -11)
        
PushttNull"S_push 2"0Handlet)) ; Handlet1)
    
Pusht1Null""0Handlett)) 
    
        ;
by_Index.Node byIndex(t1t1\totalNode)
        ;If 
nodeBy_Index <> Null Then DebugLog "Index " t1\totalNode " = Try" Else DebugLog "Index 1 = None"
        
;If nodeById(t12) <> Null Then DebugLog "ID 2 = Try" Else DebugLog "ID 2 = None"
        
;If nodeByText(t1"push") <> Null Then DebugLog "Text = Try" Else DebugLog "Text = None"
    
    
t2.List = NewList(" t2 ")
    
    
t3.List = NewList(" t3 ")
    
t3\name " t3 "
    
    
free_List_ID FreeListID()
    
free_Node_ID FreeNodeID()
    
    
    ;
SortByID(t11
    
While 
Not KeyHit(1)
Cls 
    
;If KeyHit(11Then Pusht1Shift(t1))                                     ; key "0"
    
If KeyHit(2Then Pusht1Shift(t1))                                         ; key "1"
    
If KeyHit(3Then UnShiftt1Pop(t1))                                     ; key "2"
    
If KeyHit(4Then Pop(t1)                                                     ; key "3"
    
If KeyHit(5Then Shift(t1)                                                 ; key "4"
    
If KeyHit(6Then SortListt1LOWERTEXTpositive_negative)                ; key "5"
    
If KeyHit(7Then SortListt1NUMERICpositive_negative)                    ; key "6"
    
If KeyHit(8Then SortListt1LISTNULLpositive_negative)                ; key "7"
    
If KeyHit(9Then SortListt1LOWERTEXT Or NUMERICpositive_negative)    ; key "8"
    
    
If KeyHit(28Then positive_negative Not positive_negative                key "Enter"
    
If KeyHit(30Then all_node Not all_node                                    key "A"
    
If KeyHit(17Then SwapNodenodebyIndex(t11), nodebyIndex(t12))         ; key "W"
    
If KeyHit(33Then free_Node_ID FreeNodeID()                                 ; key "F"
    
If KeyHit(23Then ListInverse(t1)                                             ; key "I"
    
If KeyHit(19Then ListReverse(t1t1)                                         ; key "R"
    
If KeyHit(31Then ListSlicet1t323)                                    ; key "S"
    
If KeyHit(16Then SortByID(t1positive_negative)                             ; key "Q"
    
If KeyHit(18Then ListErase(t2)                                             ; key "E"
    
If KeyHit(25Then num num Pusht1Null"pusH " numnum)        ; key "P"
    
If KeyHit(32Then DelByIndex(t11)                                         ; key "D"
    
If KeyHit(46Then CopyList(t1t2)                                         ; key "C"
    
If KeyHit(37Then t2 CloneList(t1)                                         ; key "K"
    
If KeyHit(45Then DeleteList(t3)                                             ; key "X"
    
    
    
If all_node False Then 
        AllListNode
3070)
        ;
AllNode3020)
        ;
AllList30400)
    Else
        
ListText(t13060
        
ListText(t230240
        
ListText(t330440
    EndIf
    
    If 
positive_negative Then 
        Text 10
2"positive_negative = True,     positive [ 1 ... ] " 
    
Else 
        
Text 102"positive_negative = False,      negative [ ... 1 ]"
    
EndIf
    
    
Text 1022"free Node ID = " free_Node_ID ", max Node ID = " NodeID ", pool Node ID = " poolNodeID
    Text 10
42"free List ID = " free_List_ID ", max List ID = " ListID ", pool List ID = " poolListID
    
;If <> Null Then Text 22022"[ n ] 'ID' : " n\id ", 'Text' : " n\txt "  " 
    
    
nodeByTextt1"Push")
    If 
<> Null Then
        pp
.Point Object.Pointn\Hndl)
        If 
pp <> Null Then Text 4702"Oblect_Handle ... Point " pp\"  " pp\y
    
EndIf
Flip 
Wend 
;: FlushKeys WaitKey 
End 
__________________
Мой проект здесь

Последний раз редактировалось Randomize, 09.04.2025 в 13:51.
(Offline)
 
Ответить с цитированием
Ответ


Опции темы

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


Часовой пояс GMT +4, время: 11:54.


vBulletin® Version 3.6.5.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot
Style crйe par Allan - vBulletin-Ressources.com