Worte Worte oder Zahlen zuordnen. [B3D,B+]
Übersicht

MatthiasBetreff: Worte Worte oder Zahlen zuordnen. [B3D,B+] |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hay. Heute nachmittag hab ich hier im Forum ein Interessantes Thema gefunden
in dem es darum ging. Zahlen Worte zuordnen. Also hab ich mich mal hingesetzt un versucht so etwas zu Programmieren. Als ich fertig war, wars leider zu spät. Vieleicht kanns ja jemand gebrauchen. Allerdings kann mann auch Worte Worte zuordnen. Da ich ein StringMap benutzt habe. Code: [AUSKLAPPEN] Graphics 800,600,32,2 SetBuffer BackBuffer() MapSize=20000 Dim StringMap$(MapSize) Global DATA_STRUCK=CreateBank(16384+MapSize) SetString("MeinAuto45","Blau") SetString("MeinAuto54","Grün") SetString("MeinAuto45","Lila") Print GetString("MeinAuto45") Print GetString("MeinAuto54") Flip Repeat:Until KeyDown(1)=1 End Function GetString$(KY$) Local L=Len(KY):B=-20 For Z=1 To 16:If Z<=L A=Asc(Mid(KY,Z,1)) Ad=Ad+A:W=W Shl 8+A:A=0:If Z=4 W1=W:W=0 If Z=8 W2=W:W=0 ElseIf Z=12 W3=W:W=0 Next Bk=PeekInt(DATA_STRUCK,Ad*4):If Bk=0 Return 0 BS=BankSize(Bk) While B<=BS:B=B+20:Select PeekInt(Bk,B):Case W1 If PeekInt(Bk,B+4)=W2 And PeekInt(Bk,B+4)=W2 If PeekInt(Bk,B+8)=W3 ID=PeekInt(Bk,B+16):Exit End If End Select:Wend Return StringMap(ID) End Function Function SetString(KY$,ST$) Local L=Len(KY) For Z=1 To 16:If Z<=L A=Asc(Mid(KY,Z,1)) Ad=Ad+A:W=W Shl 8+A:A=0:If Z=4 W1=W:W=0 If Z=8 W2=W:W=0 ElseIf Z=12 W3=W:W=0 Next Bk=PeekInt(DATA_STRUCK,Ad*4) Select Bk<>0:Case 1:BS=BankSize(Bk):Default Bk=CreateBank(0):PokeInt(DATA_STRUCK,Ad*4,Bk) End Select While B<BS If PeekInt(Bk,B+0)=W1 And PeekInt(Bk,B+4)=W2 Then If PeekInt(Bk,B+8)=W3 And PeekInt(Bk,B+12)=W Exit End If:B=B+20 Wend If B=BS Then ResizeBank(Bk,BS+20):CB=BankSize(DATA_STRUCK) PokeInt(BK,B+8,W3):PokeInt(Bk,B,W1):J=16383 PokeInt(Bk,B+4,W2):PokeInt(Bk,B+12,W) While J<CB:J=J+1 If PeekByte(DATA_STRUCK,J)=0 Then ID=J-16384:PokeInt(Bk,B+16,ID) PokeByte(DATA_STRUCK,J,1):Exit End If Wend End If If B<>BS Then ID=PeekInt(Bk,B+16) StringMap(ID)=ST$ End Function |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group