SC CODE: /// dReam Tables Holdero v1.1.0
Function InitializePrivate() Uint64
10 IF EXISTS("owner:") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner:", SIGNER())
40 STORE("Deck Count:", 52)
50 STORE("Player:", 0)
60 STORE("New", 1)
70 STORE("V:", 110)
80 STORE("dReams", HEXDECODE("ad2e7b37c380cc1aed3a6b27224ddfc92a2d15962ca1f4d35e530dba0f9575a9"))
90 shuffleDeck()
100 RETURN 0
End Function
Function clearTable() Uint64
10 DIM i as Uint64
20 LET i = LOAD("OBF")
30 DELETE(SHA256(ITOA(i*i*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)))
40 LET i = i +1
50 IF i < 1+LOAD("OBF")+52 THEN GOTO 30
60 RETURN 0
End Function
Function shuffleDeck() Uint64
5 IF EXISTS("New") THEN GOTO 30 ELSE GOTO 10
10 IF LOAD("owner:") == SIGNER() THEN GOTO 20
15 RETURN 1
20 clearTable()
30 STORE("Deck Count:", 52)
40 IF EXISTS("New") THEN GOTO 330
50 DELETE("End")
60 DELETE("Bet")
70 DELETE("Wager:")
80 DELETE("Raised:")
90 takeBackCards(1)
100 takeBackCards(2)
110 takeBackCards(3)
120 takeBackCards(4)
130 takeBackCards(5)
140 takeBackCards(6)
150 IF EXISTS("1SO") THEN GOTO 170
160 DELETE("1F")
170 IF EXISTS("2SO") THEN GOTO 190
180 DELETE("2F")
190 IF EXISTS("3SO") THEN GOTO 210
200 DELETE("3F")
210 IF EXISTS("4SO") THEN GOTO 230
220 DELETE("4F")
230 IF EXISTS("5SO") THEN GOTO 250
240 DELETE("5F")
250 IF EXISTS("0SO") THEN GOTO 270
260 DELETE("0F")
270 STORE("Player:", LOAD("Dealer:")+1)
280 STORE("Dealer:", LOAD("Dealer:")+1)
290 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 300 ELSE GOTO 320
300 STORE("Player:", 0)
310 STORE("Dealer:", 0)
320 IF EXISTS(ITOA(LOAD("Player:"))+"SO") THEN GOTO 270
330 STORE("Counter:", 1)
340 DELETE("New")
350 DELETE("W")
360 STORE("Pot:", 0)
370 STORE("IV", 1+ RANDOM(99999))
380 STORE("OBF", 1+ RANDOM(9999999))
390 DELETE("Flop")
400 DELETE("Turn")
410 DELETE("River")
420 DELETE("FlopCard1")
430 DELETE("FlopCard2")
440 DELETE("FlopCard3")
450 DELETE("TurnCard")
460 DELETE("RiverCard")
470 DELETE("Reveal")
480 STORE("HandSeed", SHA256(ITOA(9999999)))
490 RETURN 0
End Function
Function takeBackCards(playerNumber Uint64) Uint64
10 DELETE(("Player")+ITOA(playerNumber)+("card1"))
20 DELETE(("Player")+ITOA(playerNumber)+("card2"))
30 DELETE("Player"+ITOA(playerNumber)+"Key")
40 RETURN 0
End Function
Function Winner(whoWon String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF LOAD("Chips") == "DERO" THEN GOTO 100
40 IF LOAD("Chips") == "ASSET" THEN GOTO 200
50 RETURN 1
100 SEND_DERO_TO_ADDRESS(LOAD("owner:"), (150*LOAD("Pot:")/10000))
120 SEND_DERO_TO_ADDRESS(LOAD(whoWon), (9850*LOAD("Pot:")/10000))
125 shuffleDeck()
130 RETURN 0
200 SEND_ASSET_TO_ADDRESS(LOAD("owner:"), (150*LOAD("Pot:")/10000), LOAD("dReams"))
220 SEND_ASSET_TO_ADDRESS(LOAD(whoWon), (9850*LOAD("Pot:")/10000), LOAD("dReams"))
230 shuffleDeck()
250 RETURN 0
End Function
Function split(div Uint64, who String) Uint64
10 IF LOAD("Chips") == "DERO" THEN GOTO 100
20 IF LOAD("Chips") == "ASSET" THEN GOTO 200
30 RETURN 1
100 SEND_DERO_TO_ADDRESS(LOAD(who), (LOAD("Pot:")/div))
120 RETURN 0
200 SEND_ASSET_TO_ADDRESS(LOAD(who), (LOAD("Pot:")/div), LOAD("dReams"))
300 RETURN 0
End Function
Function remains(div Uint64) Uint64
20 IF LOAD("Chips") == "DERO" THEN GOTO 100
30 IF LOAD("Chips") == "ASSET" THEN GOTO 200
40 RETURN 1
100 SEND_DERO_TO_ADDRESS(LOAD("owner:"), (LOAD("Pot:")%div))
120 RETURN 0
200 SEND_ASSET_TO_ADDRESS(LOAD("owner:"), (LOAD("Pot:")%div), LOAD("dReams"))
300 RETURN 0
End Function
Function SplitWinner(div Uint64, split1 String, split2 String, split3 String, split4 String, split5 String, split6 String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 80
20 RETURN 1
80 IF div == 2 THEN GOTO 150
90 IF div == 3 THEN GOTO 200
100 IF div == 4 THEN GOTO 270
110 IF div == 5 THEN GOTO 350
120 IF div == 6 THEN GOTO 430
130 RETURN 1
150 split(div, split1)
160 split(div, split2)
165 remains(div)
170 shuffleDeck()
180 RETURN 0
200 split(div, split1)
210 split(div, split2)
220 split(div, split3)
230 remains(div)
240 shuffleDeck()
250 RETURN 0
270 split(div, split1)
280 split(div, split2)
290 split(div, split3)
300 split(div, split4)
310 remains(div)
320 shuffleDeck()
330 RETURN 0
350 split(div, split1)
360 split(div, split2)
370 split(div, split3)
380 split(div, split4)
390 split(div, split5)
395 remains(div)
400 shuffleDeck()
410 RETURN 0
430 split(div, split1)
440 split(div, split2)
450 split(div, split3)
460 split(div, split4)
470 split(div, split5)
480 split(div, split6)
490 remains(div)
500 shuffleDeck()
510 RETURN 0
End Function
Function SetTable(seats Uint64, ante Uint64, bigBlind Uint64, smallBlind Uint64, address String, chips String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF seats == 1 THEN GOTO 160
35 IF EXISTS("Seats at Table:") THEN GOTO 20
40 STORE("Seats at Table:", seats)
50 IF LOAD("Seats at Table:") > 6 THEN GOTO 20
55 STORE("Chips", chips)
60 STORE("Ante:", ante)
65 STORE("BB:", bigBlind)
66 STORE("SB:", smallBlind)
70 STORE("Player:", LOAD("Player:")+1)
80 STORE(("Player")+ITOA(LOAD("Player:")), SIGNER())
90 STORE(("Player")+ITOA(LOAD("Player:"))+(" ID:"), HEXDECODE(address))
100 STORE("Counter:", 1)
110 STORE("Pot:", 0)
120 STORE("IV", 1+ RANDOM(99999))
130 STORE("Dealer:", 0)
140 STORE("OBF", 1+ RANDOM(9999999))
150 STORE("HandSeed", SHA256(ITOA(9999999)))
155 RETURN 0
160 clearTable()
170 DELETE("Player1")
180 DELETE("Player2")
190 DELETE("Player3")
200 DELETE("Player4")
210 DELETE("Player5")
220 DELETE("Player6")
230 DELETE("Player1 ID:")
240 DELETE("Player2 ID:")
250 DELETE("Player3 ID:")
260 DELETE("Player4 ID:")
270 DELETE("Player4 ID:")
280 DELETE("Player5 ID:")
290 DELETE("Player6 ID:")
300 DELETE("Seats at Table:")
310 DELETE("Ante:")
320 DELETE("GameKey:")
330 STORE("Player:", 0)
340 DELETE("Full")
350 DELETE("IV")
360 DELETE("Open")
370 takeBackCards(1)
380 takeBackCards(2)
390 takeBackCards(3)
400 takeBackCards(4)
410 takeBackCards(5)
420 takeBackCards(6)
430 DELETE("0F")
440 DELETE("1F")
450 DELETE("2F")
460 DELETE("3F")
470 DELETE("4F")
480 DELETE("5F")
490 DELETE("0SO")
500 DELETE("1SO")
510 DELETE("2SO")
520 DELETE("3SO")
530 DELETE("4SO")
540 DELETE("5SO")
550 DELETE("Dealer:")
560 DELETE("OBF")
570 DELETE("W")
580 DELETE("Bet")
590 DELETE("Wager:")
600 DELETE("Raised:")
610 DELETE("End")
620 STORE("Pot:", 0)
630 STORE("Deck Count:", 52)
640 DELETE("HandSeed")
650 DELETE("Flop")
660 DELETE("Turn")
670 DELETE("River")
680 DELETE("FlopCard1")
690 DELETE("FlopCard2")
700 DELETE("FlopCard3")
710 DELETE("TurnCard")
720 DELETE("RiverCard")
730 DELETE("Reveal")
740 DELETE("BB:")
750 DELETE("SB:")
760 DELETE("Face:")
770 DELETE("Back:")
780 DELETE("Chips")
790 DELETE("Last")
800 RETURN 0
End Function
Function PlayerEntry(address String) Uint64
10 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 150
20 IF EXISTS("Full") THEN GOTO 150
30 IF LOAD("owner:") == SIGNER() THEN GOTO 130
40 IF EXISTS("Open") THEN GOTO 160
50 IF LOAD("Player:") == 0 THEN GOTO 145
60 STORE("Player:", LOAD("Player:")+1)
70 STORE(("Player")+ITOA(LOAD("Player:")), SIGNER())
80 STORE(("Player")+ITOA(LOAD("Player:"))+(" ID:"), HEXDECODE(address))
90 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 110
100 RETURN 0
110 STORE("Full", 1)
120 RETURN 0
130 DELETE("0SO")
135 STORE("Open", LOAD("Open")-1)
136 IF LOAD("Open") == 0 THEN GOTO 260
140 RETURN 0
145 IF EXISTS("Open") THEN GOTO 160
150 RETURN 1
160 MAPSTORE("checkSeats", 0)
170 MAPSTORE("checkSeats", MAPGET("checkSeats")+1)
180 IF MAPGET("checkSeats") >= 7 THEN GOTO 150
190 IF EXISTS(("Player")+ITOA(MAPGET("checkSeats"))+(" ID:")) THEN GOTO 170
200 STORE(("Player")+ITOA(MAPGET("checkSeats")), SIGNER())
210 STORE(("Player")+ITOA(MAPGET("checkSeats"))+(" ID:"), HEXDECODE(address))
220 STORE("Open", LOAD("Open")-1)
230 DELETE(ITOA(MAPGET("checkSeats")-1)+"SO")
240 IF LOAD("Open") == 0 THEN GOTO 260
250 RETURN 0
260 DELETE("Open")
270 STORE("Full", 1)
280 RETURN 0
End Function
Function PlayerLeave(id Uint64) Uint64
10 IF EXISTS("Bet") THEN GOTO 280
30 IF playerCheck() THEN GOTO 40 ELSE GOTO 280
40 STORE(ITOA(id-1)+"F", 1)
50 STORE(ITOA(id-1)+"SO", 1)
60 IF LOAD("owner:") == SIGNER() THEN GOTO 100
70 STORE(("Player")+ITOA(id), "Out")
80 DELETE(("Player")+ITOA(id)+(" ID:"))
100 takeBackCards(id)
110 clock()
120 foldedLoop()
130 IF playerLoop() THEN GOTO 140 ELSE GOTO 160
140 STORE("Player:", 0)
150 foldedLoop()
160 IF counterLoop() THEN GOTO 170 ELSE GOTO 220
170 STORE("Counter:", 1)
180 STORE("Bet", 1)
220 openSpot()
270 RETURN 0
280 RETURN 1
End Function
Function openSpot() Uint64
10 DELETE("Full")
20 IF EXISTS("Open") THEN GOTO 50
30 STORE("Open", 1)
40 RETURN 0
50 STORE("Open", LOAD("Open")+1)
60 RETURN 0
End Function
Function clock() Uint64
10 STORE("Player:", LOAD("Player:")+1)
20 STORE("Counter:", LOAD("Counter:")+1)
30 IF EXISTS("W") THEN GOTO 40 ELSE GOTO 50
40 STORE("W", LOAD("W")+1)
50 STORE("Last", BLOCK_TIMESTAMP())
60 RETURN 0
End Function
Function playerLoop() Uint64
10 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 30
20 RETURN 0
30 RETURN 1
End Function
Function counterLoop() Uint64
10 IF LOAD("Counter:") > LOAD("Seats at Table:") THEN GOTO 30
20 RETURN 0
30 RETURN 1
End Function
Function foldedLoop() Uint64
10 folded()
20 folded()
30 folded()
40 folded()
50 folded()
60 RETURN 0
End Function
Function folded() Uint64
10 IF LOAD("Player:") == 0 THEN GOTO 20 ELSE GOTO 50
20 IF EXISTS("0F") THEN GOTO 30 ELSE GOTO 40
30 clock()
40 RETURN 0
50 IF LOAD("Player:") == 1 THEN GOTO 60 ELSE GOTO 90
60 IF EXISTS("1F") THEN GOTO 70 ELSE GOTO 80
70 clock()
80 RETURN 0
90 IF LOAD("Player:") == 2 THEN GOTO 100 ELSE GOTO 130
100 IF EXISTS("2F") THEN GOTO 110 ELSE GOTO 120
110 clock()
120 RETURN 0
130 IF LOAD("Player:") == 3 THEN GOTO 140 ELSE GOTO 170
140 IF EXISTS("3F") THEN GOTO 150 ELSE GOTO 160
150 clock()
160 RETURN 0
170 IF LOAD("Player:") == 4 THEN GOTO 180 ELSE GOTO 210
180 IF EXISTS("4F") THEN GOTO 190 ELSE GOTO 200
190 clock()
200 RETURN 0
210 IF LOAD("Player:") == 5 THEN GOTO 220 ELSE GOTO 250
220 IF EXISTS("5F") THEN GOTO 230 ELSE GOTO 200
230 clock()
240 RETURN 0
250 RETURN 1
End Function
Function playerCheck() Uint64
5 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 6 ELSE GOTO 10
6 STORE("Player:", 0)
10 IF LOAD("Player:") == 0 THEN GOTO 20 ELSE GOTO 30
20 IF SIGNER() == LOAD("Player1") THEN GOTO 150 ELSE GOTO 200
30 IF LOAD("Player:") == 1 THEN GOTO 40 ELSE GOTO 50
40 IF SIGNER() == LOAD("Player2") THEN GOTO 150 ELSE GOTO 200
50 IF LOAD("Player:") == 2 THEN GOTO 60 ELSE GOTO 70
60 IF SIGNER() == LOAD("Player3") THEN GOTO 150 ELSE GOTO 200
70 IF LOAD("Player:") == 3 THEN GOTO 80 ELSE GOTO 90
80 IF SIGNER() == LOAD("Player4") THEN GOTO 150 ELSE GOTO 200
90 IF LOAD("Player:") == 4 THEN GOTO 100 ELSE GOTO 110
100 IF SIGNER() == LOAD("Player5") THEN GOTO 150 ELSE GOTO 200
110 IF LOAD("Player:") == 5 THEN GOTO 120 ELSE GOTO 200
120 IF SIGNER() == LOAD("Player6") THEN GOTO 150 ELSE GOTO 200
150 RETURN 1
200 RETURN 0
End Function
Function dealFunc(pcSeed String) Uint64
10 doubleCard(pcSeed)
20 foldedLoop()
30 STORE("Pot:", LOAD("Pot:")+playingWith())
40 IF playerLoop() THEN GOTO 70
50 IF counterLoop() THEN GOTO 110
60 RETURN 0
70 STORE("Player:", 0)
80 foldedLoop()
90 IF counterLoop() THEN GOTO 110
100 RETURN 0
110 STORE("Bet", 1)
120 STORE("Counter:", 1)
130 RETURN 0
End Function
Function DealHand(pcSeed String) Uint64
4 IF EXISTS("Reveal") THEN GOTO 600
5 IF EXISTS("Flop") THEN GOTO 600
10 IF EXISTS("Turn") THEN GOTO 600
20 IF EXISTS("River") THEN GOTO 600
30 IF EXISTS("Bet") THEN GOTO 600
40 IF playerCheck() THEN GOTO 50 ELSE GOTO 600
50 IF LOAD("Pot:") == 0 THEN GOTO 60 ELSE GOTO 90
60 IF playingWith() == LOAD("Ante:")+LOAD("SB:") THEN GOTO 70 ELSE GOTO 600
70 dealFunc(pcSeed)
80 RETURN 0
90 IF LOAD("Pot:") == LOAD("Ante:")+LOAD("SB:") THEN GOTO 100 ELSE GOTO 130
100 IF playingWith() == LOAD("Ante:")+LOAD("BB:") THEN GOTO 110 ELSE GOTO 600
110 dealFunc(pcSeed)
120 RETURN 0
130 IF playingWith() == LOAD("Ante:") THEN GOTO 140 ELSE GOTO 600
140 dealFunc(pcSeed)
150 RETURN 0
600 RETURN 1
End Function
Function flop() Uint64
10 singleCard("FlopCard1")
20 singleCard("FlopCard2")
30 singleCard("FlopCard3")
40 STORE("Deck Count:", LOAD("Deck Count:")-3)
50 RETURN 0
End Function
Function singleCard(w String) Uint64
5 DIM card as Uint64
10 LET card = 1+LOAD("OBF")+ RANDOM(52)
20 IF EXISTS(SHA256(ITOA(card*card*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3))) THEN GOTO 10
30 STORE(SHA256(ITOA(card*card*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)), card/LOAD("IV"))
40 STORE(w, card-LOAD("OBF"))
45 IF w == "FlopCard1" || w == "FlopCard2" || w == "FlopCard3" THEN GOTO 90
50 clock()
70 STORE("Deck Count:", LOAD("Deck Count:")-1)
90 RETURN 0
End Function
Function doubleCard(pcSeed String) Uint64
5 DIM holeCardOne, holeCardTwo as Uint64
10 LET holeCardOne = 1+LOAD("OBF")+ RANDOM(52)
20 IF EXISTS(SHA256(ITOA(holeCardOne*holeCardOne*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3))) THEN GOTO 10
30 clock()
35 STORE(SHA256(ITOA(holeCardOne*holeCardOne*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)), holeCardOne/LOAD("IV"))
40 MAPSTORE("hCard1", HEX(pcSeed)+ITOA(holeCardOne-LOAD("OBF"))+HEX(LOAD("HandSeed")))
70 STORE("Player"+ITOA(LOAD("Player:"))+"card1", SHA256(MAPGET("hCard1")))
80 LET holeCardTwo = 1+LOAD("OBF")+ RANDOM(52)
90 IF EXISTS(SHA256(ITOA(holeCardTwo*holeCardTwo*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3))) THEN GOTO 80
100 STORE(SHA256(ITOA(holeCardTwo*holeCardTwo*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)), holeCardTwo/LOAD("IV"))
110 MAPSTORE("hCard2", HEX(pcSeed)+ITOA(holeCardTwo-LOAD("OBF"))+HEX(LOAD("HandSeed")))
120 STORE("Player"+ITOA(LOAD("Player:"))+"card2", SHA256(MAPGET("hCard2")))
130 STORE("Deck Count:", LOAD("Deck Count:")-2)
140 RETURN 0
End Function
Function Bet() Uint64
4 IF EXISTS("Reveal") THEN GOTO 700
5 IF playerCheck() THEN GOTO 10 ELSE GOTO 700
10 IF EXISTS("Wager:") THEN GOTO 50
20 IF playingWith() == 0 THEN GOTO 100
30 IF playingWith() >= LOAD("Ante:") THEN GOTO 40 ELSE GOTO 700
40 STORE("Wager:", playingWith())
41 STORE("Pot:", LOAD("Pot:")+playingWith())
43 clock()
44 STORE("W", 1)
45 foldedLoop()
47 IF playerLoop() THEN GOTO 200
48 IF counterLoop() THEN GOTO 470
49 RETURN 0
50 IF playingWith() == LOAD("Wager:") THEN GOTO 55 ELSE GOTO 73
55 clock()
57 foldedLoop()
62 STORE("Pot:", LOAD("Pot:")+playingWith())
69 IF playerLoop() THEN GOTO 200
70 IF counterLoop() THEN GOTO 470
71 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
72 RETURN 0
73 IF EXISTS("Raised:") THEN GOTO 74 ELSE GOTO 89
74 IF playingWith() == LOAD("Raised:") THEN GOTO 75 ELSE GOTO 89
75 STORE("Pot:", LOAD("Pot:")+playingWith())
76 clock()
77 foldedLoop()
78 IF playerLoop() THEN GOTO 200
79 IF counterLoop() THEN GOTO 470
80 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
81 RETURN 0
89 IF EXISTS("Raised:") THEN GOTO 118
90 IF playingWith() > LOAD("Wager:") THEN GOTO 91 ELSE GOTO 118
91 clock()
92 STORE("W", 1)
93 foldedLoop()
94 STORE("Raised:", playingWith()-LOAD("Wager:"))
95 STORE("Pot:", LOAD("Pot:")+playingWith())
96 STORE("Wager:", playingWith())
97 IF playerLoop() THEN GOTO 200
98 IF counterLoop() THEN GOTO 470
99 RETURN 0
100 clock()
105 foldedLoop()
110 IF playerLoop() THEN GOTO 200
111 IF counterLoop() THEN GOTO 470
115 RETURN 0
118 IF playingWith() == 0 THEN GOTO 120 ELSE GOTO 700
120 STORE(ITOA(LOAD("Player:"))+"F", 1)
125 clock()
126 takeBackCards(LOAD("Player:"))
127 foldedLoop()
130 IF playerLoop() THEN GOTO 200
131 IF counterLoop() THEN GOTO 470
132 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
140 RETURN 0
200 STORE("Player:", 0)
201 foldedLoop()
210 IF counterLoop() THEN GOTO 470
211 IF EXISTS("W") THEN GOTO 215 ELSE GOTO 220
215 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
220 RETURN 0
470 STORE("Counter:", 1)
473 IF EXISTS("W") THEN GOTO 474 ELSE GOTO 475
474 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475 ELSE GOTO 220
475 loopSequence()
500 RETURN 0
700 RETURN 1
End Function
Function loopSequence() Uint64
10 IF EXISTS("Flop") THEN GOTO 50
20 flop()
30 STORE("Flop", 1)
40 GOTO 170
50 IF EXISTS("River") THEN GOTO 130
60 IF EXISTS("Turn") THEN GOTO 100
70 STORE("Turn", 1)
80 singleCard("TurnCard")
90 GOTO 170
100 singleCard("RiverCard")
110 STORE("River", 1)
120 GOTO 170
130 STORE("Reveal", 1)
140 DELETE("Turn")
150 DELETE("River")
160 DELETE("Bet")
170 STORE("Player:", LOAD("Dealer:"))
180 IF EXISTS(ITOA(LOAD("Dealer:"))+"F") THEN GOTO 190 ELSE GOTO 230
190 STORE("Player:", LOAD("Player:")+1)
200 IF EXISTS(ITOA(LOAD("Player:"))+"F") THEN GOTO 190
210 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 220 ELSE GOTO 230
220 STORE("Player:", 0)
230 STORE("Counter:", 1)
240 DELETE("Wager:")
250 DELETE("W")
260 DELETE("Raised:")
270 RETURN 0
End Function
Function RevealKey(pcSeed String) Uint64
10 IF EXISTS("Reveal") THEN GOTO 30
20 RETURN 1
30 IF playerCheck() THEN GOTO 40 ELSE GOTO 20
40 clock()
50 STORE("Player"+ITOA(LOAD("Player:"))+"Key", pcSeed)
60 foldedLoop()
70 IF playerLoop() THEN GOTO 80 ELSE GOTO 100
80 STORE("Player:", 0)
90 foldedLoop()
100 IF counterLoop() THEN GOTO 110 ELSE GOTO 140
110 STORE("Counter:", 1)
120 STORE("End", 1)
130 DELETE("Reveal")
140 RETURN 0
End Function
Function ForceStart() Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("Player:", LOAD("Seats at Table:"))
40 MAPSTORE("Count", 0)
45 DIM s as Uint64
46 LET s = LOAD("Seats at Table:")
50 IF EXISTS("Player3 ID:") == 0 && s >= 3 THEN GOTO 60 ELSE GOTO 100
60 STORE("2SO", 1)
70 MAPSTORE("Count", 1)
80 STORE("Open", MAPGET("Count"))
90 STORE("2F", 1)
100 IF EXISTS("Player4 ID:") == 0 && s >= 4 THEN GOTO 110 ELSE GOTO 150
110 STORE("3SO", 1)
120 MAPSTORE("Count", MAPGET("Count")+1)
130 STORE("Open", MAPGET("Count"))
140 STORE("3F", 1)
150 IF EXISTS("Player5 ID:") == 0 && s >= 5 THEN GOTO 160 ELSE GOTO 200
160 STORE("4SO", 1)
170 MAPSTORE("Count", MAPGET("Count")+1)
180 STORE("Open", MAPGET("Count"))
190 STORE("4F", 1)
200 IF EXISTS("Player6 ID:") == 0 && s == 6 THEN GOTO 210 ELSE GOTO 250
210 STORE("5SO", 1)
220 MAPSTORE("Count", MAPGET("Count")+1)
230 STORE("Open", MAPGET("Count"))
240 STORE("5F", 1)
250 RETURN 0
End Function
Function CleanTable(amount Uint64) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF LOAD("Chips") == "ASSET" THEN GOTO 60
40 SEND_DERO_TO_ADDRESS(SIGNER(), amount)
50 GOTO 70
60 SEND_ASSET_TO_ADDRESS(SIGNER(), amount, LOAD("dReams"))
70 shuffleDeck()
80 RETURN 0
End Function
Function Deck(face String, back String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("Face:", face)
40 STORE("Back:", back)
50 RETURN 0
End Function
Function TimeOut() Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF BLOCK_TIMESTAMP() > LOAD("Last")+45 THEN GOTO 45
40 RETURN 0
45 DIM p as Uint64
50 LET p = LOAD("Player:")
55 IF p == 0 THEN GOTO 40
56 openSpot()
60 takeBackCards(p+1)
70 STORE(ITOA(p)+"F", 1)
80 STORE(ITOA(p)+"SO", 1)
81 DELETE("Player"+ITOA(p+1))
82 DELETE("Player"+ITOA(p+1)+" ID:")
83 clock()
90 IF playerLoop() THEN GOTO 120
100 IF counterLoop() THEN GOTO 140
105 foldedLoop()
106 IF playerLoop() THEN GOTO 120
107 IF counterLoop() THEN GOTO 140
110 RETURN 0
120 STORE("Player:", 0)
130 foldedLoop()
140 IF counterLoop() && EXISTS("Bet") THEN GOTO 473
145 IF counterLoop() THEN GOTO 160
150 RETURN 0
160 STORE("Bet", 1)
170 STORE("Counter:", 1)
180 RETURN 0
473 IF EXISTS("W") THEN GOTO 474 ELSE GOTO 475
474 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475 ELSE GOTO 500
475 loopSequence()
500 RETURN 0
End Function
Function playingWith() Uint64
10 IF LOAD("Chips") == "DERO" THEN GOTO 50
20 IF LOAD("Chips") == "ASSET" THEN GOTO 70
30 RETURN 12
50 IF ASSETVALUE(LOAD("dReams")) > 0 THEN GOTO 30
60 RETURN DEROVALUE()
70 IF DEROVALUE() > 0 THEN GOTO 30
80 RETURN ASSETVALUE(LOAD("dReams"))
End Function |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'/// dReam Tables Holdero v1.1.0
Function InitializePrivate() Uint64
10 IF EXISTS("owner:") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner:", SIGNER())
40 STORE("Deck Count:", 52)
50 STORE("Player:", 0)
60 STORE("New", 1)
70 STORE("V:", 110)
80 STORE("dReams", HEXDECODE("ad2e7b37c380cc1aed3a6b27224ddfc92a2d15962ca1f4d35e530dba0f9575a9"))
90 shuffleDeck()
100 RETURN 0
End Function
Function clearTable() Uint64
10 DIM i as Uint64
20 LET i = LOAD("OBF")
30 DELETE(SHA256(ITOA(i*i*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)))
40 LET i = i +1
50 IF i < 1+LOAD("OBF")+52 THEN GOTO 30
60 RETURN 0
End Function
Function shuffleDeck() Uint64
5 IF EXISTS("New") THEN GOTO 30 ELSE GOTO 10
10 IF LOAD("owner:") == SIGNER() THEN GOTO 20
15 RETURN 1
20 clearTable()
30 STORE("Deck Count:", 52)
40 IF EXISTS("New") THEN GOTO 330
50 DELETE("End")
60 DELETE("Bet")
70 DELETE("Wager:")
80 DELETE("Raised:")
90 takeBackCards(1)
100 takeBackCards(2)
110 takeBackCards(3)
120 takeBackCards(4)
130 takeBackCards(5)
140 takeBackCards(6)
150 IF EXISTS("1SO") THEN GOTO 170
160 DELETE("1F")
170 IF EXISTS("2SO") THEN GOTO 190
180 DELETE("2F")
190 IF EXISTS("3SO") THEN GOTO 210
200 DELETE("3F")
210 IF EXISTS("4SO") THEN GOTO 230
220 DELETE("4F")
230 IF EXISTS("5SO") THEN GOTO 250
240 DELETE("5F")
250 IF EXISTS("0SO") THEN GOTO 270
260 DELETE("0F")
270 STORE("Player:", LOAD("Dealer:")+1)
280 STORE("Dealer:", LOAD("Dealer:")+1)
290 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 300 ELSE GOTO 320
300 STORE("Player:", 0)
310 STORE("Dealer:", 0)
320 IF EXISTS(ITOA(LOAD("Player:"))+"SO") THEN GOTO 270
330 STORE("Counter:", 1)
340 DELETE("New")
350 DELETE("W")
360 STORE("Pot:", 0)
370 STORE("IV", 1+ RANDOM(99999))
380 STORE("OBF", 1+ RANDOM(9999999))
390 DELETE("Flop")
400 DELETE("Turn")
410 DELETE("River")
420 DELETE("FlopCard1")
430 DELETE("FlopCard2")
440 DELETE("FlopCard3")
450 DELETE("TurnCard")
460 DELETE("RiverCard")
470 DELETE("Reveal")
480 STORE("HandSeed", SHA256(ITOA(9999999)))
490 RETURN 0
End Function
Function takeBackCards(playerNumber Uint64) Uint64
10 DELETE(("Player")+ITOA(playerNumber)+("card1"))
20 DELETE(("Player")+ITOA(playerNumber)+("card2"))
30 DELETE("Player"+ITOA(playerNumber)+"Key")
40 RETURN 0
End Function
Function Winner(whoWon String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF LOAD("Chips") == "DERO" THEN GOTO 100
40 IF LOAD("Chips") == "ASSET" THEN GOTO 200
50 RETURN 1
100 SEND_DERO_TO_ADDRESS(LOAD("owner:"), (150*LOAD("Pot:")/10000))
120 SEND_DERO_TO_ADDRESS(LOAD(whoWon), (9850*LOAD("Pot:")/10000))
125 shuffleDeck()
130 RETURN 0
200 SEND_ASSET_TO_ADDRESS(LOAD("owner:"), (150*LOAD("Pot:")/10000), LOAD("dReams"))
220 SEND_ASSET_TO_ADDRESS(LOAD(whoWon), (9850*LOAD("Pot:")/10000), LOAD("dReams"))
230 shuffleDeck()
250 RETURN 0
End Function
Function split(div Uint64, who String) Uint64
10 IF LOAD("Chips") == "DERO" THEN GOTO 100
20 IF LOAD("Chips") == "ASSET" THEN GOTO 200
30 RETURN 1
100 SEND_DERO_TO_ADDRESS(LOAD(who), (LOAD("Pot:")/div))
120 RETURN 0
200 SEND_ASSET_TO_ADDRESS(LOAD(who), (LOAD("Pot:")/div), LOAD("dReams"))
300 RETURN 0
End Function
Function remains(div Uint64) Uint64
20 IF LOAD("Chips") == "DERO" THEN GOTO 100
30 IF LOAD("Chips") == "ASSET" THEN GOTO 200
40 RETURN 1
100 SEND_DERO_TO_ADDRESS(LOAD("owner:"), (LOAD("Pot:")%div))
120 RETURN 0
200 SEND_ASSET_TO_ADDRESS(LOAD("owner:"), (LOAD("Pot:")%div), LOAD("dReams"))
300 RETURN 0
End Function
Function SplitWinner(div Uint64, split1 String, split2 String, split3 String, split4 String, split5 String, split6 String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 80
20 RETURN 1
80 IF div == 2 THEN GOTO 150
90 IF div == 3 THEN GOTO 200
100 IF div == 4 THEN GOTO 270
110 IF div == 5 THEN GOTO 350
120 IF div == 6 THEN GOTO 430
130 RETURN 1
150 split(div, split1)
160 split(div, split2)
165 remains(div)
170 shuffleDeck()
180 RETURN 0
200 split(div, split1)
210 split(div, split2)
220 split(div, split3)
230 remains(div)
240 shuffleDeck()
250 RETURN 0
270 split(div, split1)
280 split(div, split2)
290 split(div, split3)
300 split(div, split4)
310 remains(div)
320 shuffleDeck()
330 RETURN 0
350 split(div, split1)
360 split(div, split2)
370 split(div, split3)
380 split(div, split4)
390 split(div, split5)
395 remains(div)
400 shuffleDeck()
410 RETURN 0
430 split(div, split1)
440 split(div, split2)
450 split(div, split3)
460 split(div, split4)
470 split(div, split5)
480 split(div, split6)
490 remains(div)
500 shuffleDeck()
510 RETURN 0
End Function
Function SetTable(seats Uint64, ante Uint64, bigBlind Uint64, smallBlind Uint64, address String, chips String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF seats == 1 THEN GOTO 160
35 IF EXISTS("Seats at Table:") THEN GOTO 20
40 STORE("Seats at Table:", seats)
50 IF LOAD("Seats at Table:") > 6 THEN GOTO 20
55 STORE("Chips", chips)
60 STORE("Ante:", ante)
65 STORE("BB:", bigBlind)
66 STORE("SB:", smallBlind)
70 STORE("Player:", LOAD("Player:")+1)
80 STORE(("Player")+ITOA(LOAD("Player:")), SIGNER())
90 STORE(("Player")+ITOA(LOAD("Player:"))+(" ID:"), HEXDECODE(address))
100 STORE("Counter:", 1)
110 STORE("Pot:", 0)
120 STORE("IV", 1+ RANDOM(99999))
130 STORE("Dealer:", 0)
140 STORE("OBF", 1+ RANDOM(9999999))
150 STORE("HandSeed", SHA256(ITOA(9999999)))
155 RETURN 0
160 clearTable()
170 DELETE("Player1")
180 DELETE("Player2")
190 DELETE("Player3")
200 DELETE("Player4")
210 DELETE("Player5")
220 DELETE("Player6")
230 DELETE("Player1 ID:")
240 DELETE("Player2 ID:")
250 DELETE("Player3 ID:")
260 DELETE("Player4 ID:")
270 DELETE("Player4 ID:")
280 DELETE("Player5 ID:")
290 DELETE("Player6 ID:")
300 DELETE("Seats at Table:")
310 DELETE("Ante:")
320 DELETE("GameKey:")
330 STORE("Player:", 0)
340 DELETE("Full")
350 DELETE("IV")
360 DELETE("Open")
370 takeBackCards(1)
380 takeBackCards(2)
390 takeBackCards(3)
400 takeBackCards(4)
410 takeBackCards(5)
420 takeBackCards(6)
430 DELETE("0F")
440 DELETE("1F")
450 DELETE("2F")
460 DELETE("3F")
470 DELETE("4F")
480 DELETE("5F")
490 DELETE("0SO")
500 DELETE("1SO")
510 DELETE("2SO")
520 DELETE("3SO")
530 DELETE("4SO")
540 DELETE("5SO")
550 DELETE("Dealer:")
560 DELETE("OBF")
570 DELETE("W")
580 DELETE("Bet")
590 DELETE("Wager:")
600 DELETE("Raised:")
610 DELETE("End")
620 STORE("Pot:", 0)
630 STORE("Deck Count:", 52)
640 DELETE("HandSeed")
650 DELETE("Flop")
660 DELETE("Turn")
670 DELETE("River")
680 DELETE("FlopCard1")
690 DELETE("FlopCard2")
700 DELETE("FlopCard3")
710 DELETE("TurnCard")
720 DELETE("RiverCard")
730 DELETE("Reveal")
740 DELETE("BB:")
750 DELETE("SB:")
760 DELETE("Face:")
770 DELETE("Back:")
780 DELETE("Chips")
790 DELETE("Last")
800 RETURN 0
End Function
Function PlayerEntry(address String) Uint64
10 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 150
20 IF EXISTS("Full") THEN GOTO 150
30 IF LOAD("owner:") == SIGNER() THEN GOTO 130
40 IF EXISTS("Open") THEN GOTO 160
50 IF LOAD("Player:") == 0 THEN GOTO 145
60 STORE("Player:", LOAD("Player:")+1)
70 STORE(("Player")+ITOA(LOAD("Player:")), SIGNER())
80 STORE(("Player")+ITOA(LOAD("Player:"))+(" ID:"), HEXDECODE(address))
90 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 110
100 RETURN 0
110 STORE("Full", 1)
120 RETURN 0
130 DELETE("0SO")
135 STORE("Open", LOAD("Open")-1)
136 IF LOAD("Open") == 0 THEN GOTO 260
140 RETURN 0
145 IF EXISTS("Open") THEN GOTO 160
150 RETURN 1
160 MAPSTORE("checkSeats", 0)
170 MAPSTORE("checkSeats", MAPGET("checkSeats")+1)
180 IF MAPGET("checkSeats") >= 7 THEN GOTO 150
190 IF EXISTS(("Player")+ITOA(MAPGET("checkSeats"))+(" ID:")) THEN GOTO 170
200 STORE(("Player")+ITOA(MAPGET("checkSeats")), SIGNER())
210 STORE(("Player")+ITOA(MAPGET("checkSeats"))+(" ID:"), HEXDECODE(address))
220 STORE("Open", LOAD("Open")-1)
230 DELETE(ITOA(MAPGET("checkSeats")-1)+"SO")
240 IF LOAD("Open") == 0 THEN GOTO 260
250 RETURN 0
260 DELETE("Open")
270 STORE("Full", 1)
280 RETURN 0
End Function
Function PlayerLeave(id Uint64) Uint64
10 IF EXISTS("Bet") THEN GOTO 280
30 IF playerCheck() THEN GOTO 40 ELSE GOTO 280
40 STORE(ITOA(id-1)+"F", 1)
50 STORE(ITOA(id-1)+"SO", 1)
60 IF LOAD("owner:") == SIGNER() THEN GOTO 100
70 STORE(("Player")+ITOA(id), "Out")
80 DELETE(("Player")+ITOA(id)+(" ID:"))
100 takeBackCards(id)
110 clock()
120 foldedLoop()
130 IF playerLoop() THEN GOTO 140 ELSE GOTO 160
140 STORE("Player:", 0)
150 foldedLoop()
160 IF counterLoop() THEN GOTO 170 ELSE GOTO 220
170 STORE("Counter:", 1)
180 STORE("Bet", 1)
220 openSpot()
270 RETURN 0
280 RETURN 1
End Function
Function openSpot() Uint64
10 DELETE("Full")
20 IF EXISTS("Open") THEN GOTO 50
30 STORE("Open", 1)
40 RETURN 0
50 STORE("Open", LOAD("Open")+1)
60 RETURN 0
End Function
Function clock() Uint64
10 STORE("Player:", LOAD("Player:")+1)
20 STORE("Counter:", LOAD("Counter:")+1)
30 IF EXISTS("W") THEN GOTO 40 ELSE GOTO 50
40 STORE("W", LOAD("W")+1)
50 STORE("Last", BLOCK_TIMESTAMP())
60 RETURN 0
End Function
Function playerLoop() Uint64
10 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 30
20 RETURN 0
30 RETURN 1
End Function
Function counterLoop() Uint64
10 IF LOAD("Counter:") > LOAD("Seats at Table:") THEN GOTO 30
20 RETURN 0
30 RETURN 1
End Function
Function foldedLoop() Uint64
10 folded()
20 folded()
30 folded()
40 folded()
50 folded()
60 RETURN 0
End Function
Function folded() Uint64
10 IF LOAD("Player:") == 0 THEN GOTO 20 ELSE GOTO 50
20 IF EXISTS("0F") THEN GOTO 30 ELSE GOTO 40
30 clock()
40 RETURN 0
50 IF LOAD("Player:") == 1 THEN GOTO 60 ELSE GOTO 90
60 IF EXISTS("1F") THEN GOTO 70 ELSE GOTO 80
70 clock()
80 RETURN 0
90 IF LOAD("Player:") == 2 THEN GOTO 100 ELSE GOTO 130
100 IF EXISTS("2F") THEN GOTO 110 ELSE GOTO 120
110 clock()
120 RETURN 0
130 IF LOAD("Player:") == 3 THEN GOTO 140 ELSE GOTO 170
140 IF EXISTS("3F") THEN GOTO 150 ELSE GOTO 160
150 clock()
160 RETURN 0
170 IF LOAD("Player:") == 4 THEN GOTO 180 ELSE GOTO 210
180 IF EXISTS("4F") THEN GOTO 190 ELSE GOTO 200
190 clock()
200 RETURN 0
210 IF LOAD("Player:") == 5 THEN GOTO 220 ELSE GOTO 250
220 IF EXISTS("5F") THEN GOTO 230 ELSE GOTO 200
230 clock()
240 RETURN 0
250 RETURN 1
End Function
Function playerCheck() Uint64
5 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 6 ELSE GOTO 10
6 STORE("Player:", 0)
10 IF LOAD("Player:") == 0 THEN GOTO 20 ELSE GOTO 30
20 IF SIGNER() == LOAD("Player1") THEN GOTO 150 ELSE GOTO 200
30 IF LOAD("Player:") == 1 THEN GOTO 40 ELSE GOTO 50
40 IF SIGNER() == LOAD("Player2") THEN GOTO 150 ELSE GOTO 200
50 IF LOAD("Player:") == 2 THEN GOTO 60 ELSE GOTO 70
60 IF SIGNER() == LOAD("Player3") THEN GOTO 150 ELSE GOTO 200
70 IF LOAD("Player:") == 3 THEN GOTO 80 ELSE GOTO 90
80 IF SIGNER() == LOAD("Player4") THEN GOTO 150 ELSE GOTO 200
90 IF LOAD("Player:") == 4 THEN GOTO 100 ELSE GOTO 110
100 IF SIGNER() == LOAD("Player5") THEN GOTO 150 ELSE GOTO 200
110 IF LOAD("Player:") == 5 THEN GOTO 120 ELSE GOTO 200
120 IF SIGNER() == LOAD("Player6") THEN GOTO 150 ELSE GOTO 200
150 RETURN 1
200 RETURN 0
End Function
Function dealFunc(pcSeed String) Uint64
10 doubleCard(pcSeed)
20 foldedLoop()
30 STORE("Pot:", LOAD("Pot:")+playingWith())
40 IF playerLoop() THEN GOTO 70
50 IF counterLoop() THEN GOTO 110
60 RETURN 0
70 STORE("Player:", 0)
80 foldedLoop()
90 IF counterLoop() THEN GOTO 110
100 RETURN 0
110 STORE("Bet", 1)
120 STORE("Counter:", 1)
130 RETURN 0
End Function
Function DealHand(pcSeed String) Uint64
4 IF EXISTS("Reveal") THEN GOTO 600
5 IF EXISTS("Flop") THEN GOTO 600
10 IF EXISTS("Turn") THEN GOTO 600
20 IF EXISTS("River") THEN GOTO 600
30 IF EXISTS("Bet") THEN GOTO 600
40 IF playerCheck() THEN GOTO 50 ELSE GOTO 600
50 IF LOAD("Pot:") == 0 THEN GOTO 60 ELSE GOTO 90
60 IF playingWith() == LOAD("Ante:")+LOAD("SB:") THEN GOTO 70 ELSE GOTO 600
70 dealFunc(pcSeed)
80 RETURN 0
90 IF LOAD("Pot:") == LOAD("Ante:")+LOAD("SB:") THEN GOTO 100 ELSE GOTO 130
100 IF playingWith() == LOAD("Ante:")+LOAD("BB:") THEN GOTO 110 ELSE GOTO 600
110 dealFunc(pcSeed)
120 RETURN 0
130 IF playingWith() == LOAD("Ante:") THEN GOTO 140 ELSE GOTO 600
140 dealFunc(pcSeed)
150 RETURN 0
600 RETURN 1
End Function
Function flop() Uint64
10 singleCard("FlopCard1")
20 singleCard("FlopCard2")
30 singleCard("FlopCard3")
40 STORE("Deck Count:", LOAD("Deck Count:")-3)
50 RETURN 0
End Function
Function singleCard(w String) Uint64
5 DIM card as Uint64
10 LET card = 1+LOAD("OBF")+ RANDOM(52)
20 IF EXISTS(SHA256(ITOA(card*card*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3))) THEN GOTO 10
30 STORE(SHA256(ITOA(card*card*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)), card/LOAD("IV"))
40 STORE(w, card-LOAD("OBF"))
45 IF w == "FlopCard1" || w == "FlopCard2" || w == "FlopCard3" THEN GOTO 90
50 clock()
70 STORE("Deck Count:", LOAD("Deck Count:")-1)
90 RETURN 0
End Function
Function doubleCard(pcSeed String) Uint64
5 DIM holeCardOne, holeCardTwo as Uint64
10 LET holeCardOne = 1+LOAD("OBF")+ RANDOM(52)
20 IF EXISTS(SHA256(ITOA(holeCardOne*holeCardOne*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3))) THEN GOTO 10
30 clock()
35 STORE(SHA256(ITOA(holeCardOne*holeCardOne*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)), holeCardOne/LOAD("IV"))
40 MAPSTORE("hCard1", HEX(pcSeed)+ITOA(holeCardOne-LOAD("OBF"))+HEX(LOAD("HandSeed")))
70 STORE("Player"+ITOA(LOAD("Player:"))+"card1", SHA256(MAPGET("hCard1")))
80 LET holeCardTwo = 1+LOAD("OBF")+ RANDOM(52)
90 IF EXISTS(SHA256(ITOA(holeCardTwo*holeCardTwo*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3))) THEN GOTO 80
100 STORE(SHA256(ITOA(holeCardTwo*holeCardTwo*LOAD("IV")/LOAD("OBF")+LOAD("IV")/3)), holeCardTwo/LOAD("IV"))
110 MAPSTORE("hCard2", HEX(pcSeed)+ITOA(holeCardTwo-LOAD("OBF"))+HEX(LOAD("HandSeed")))
120 STORE("Player"+ITOA(LOAD("Player:"))+"card2", SHA256(MAPGET("hCard2")))
130 STORE("Deck Count:", LOAD("Deck Count:")-2)
140 RETURN 0
End Function
Function Bet() Uint64
4 IF EXISTS("Reveal") THEN GOTO 700
5 IF playerCheck() THEN GOTO 10 ELSE GOTO 700
10 IF EXISTS("Wager:") THEN GOTO 50
20 IF playingWith() == 0 THEN GOTO 100
30 IF playingWith() >= LOAD("Ante:") THEN GOTO 40 ELSE GOTO 700
40 STORE("Wager:", playingWith())
41 STORE("Pot:", LOAD("Pot:")+playingWith())
43 clock()
44 STORE("W", 1)
45 foldedLoop()
47 IF playerLoop() THEN GOTO 200
48 IF counterLoop() THEN GOTO 470
49 RETURN 0
50 IF playingWith() == LOAD("Wager:") THEN GOTO 55 ELSE GOTO 73
55 clock()
57 foldedLoop()
62 STORE("Pot:", LOAD("Pot:")+playingWith())
69 IF playerLoop() THEN GOTO 200
70 IF counterLoop() THEN GOTO 470
71 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
72 RETURN 0
73 IF EXISTS("Raised:") THEN GOTO 74 ELSE GOTO 89
74 IF playingWith() == LOAD("Raised:") THEN GOTO 75 ELSE GOTO 89
75 STORE("Pot:", LOAD("Pot:")+playingWith())
76 clock()
77 foldedLoop()
78 IF playerLoop() THEN GOTO 200
79 IF counterLoop() THEN GOTO 470
80 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
81 RETURN 0
89 IF EXISTS("Raised:") THEN GOTO 118
90 IF playingWith() > LOAD("Wager:") THEN GOTO 91 ELSE GOTO 118
91 clock()
92 STORE("W", 1)
93 foldedLoop()
94 STORE("Raised:", playingWith()-LOAD("Wager:"))
95 STORE("Pot:", LOAD("Pot:")+playingWith())
96 STORE("Wager:", playingWith())
97 IF playerLoop() THEN GOTO 200
98 IF counterLoop() THEN GOTO 470
99 RETURN 0
100 clock()
105 foldedLoop()
110 IF playerLoop() THEN GOTO 200
111 IF counterLoop() THEN GOTO 470
115 RETURN 0
118 IF playingWith() == 0 THEN GOTO 120 ELSE GOTO 700
120 STORE(ITOA(LOAD("Player:"))+"F", 1)
125 clock()
126 takeBackCards(LOAD("Player:"))
127 foldedLoop()
130 IF playerLoop() THEN GOTO 200
131 IF counterLoop() THEN GOTO 470
132 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
140 RETURN 0
200 STORE("Player:", 0)
201 foldedLoop()
210 IF counterLoop() THEN GOTO 470
211 IF EXISTS("W") THEN GOTO 215 ELSE GOTO 220
215 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475
220 RETURN 0
470 STORE("Counter:", 1)
473 IF EXISTS("W") THEN GOTO 474 ELSE GOTO 475
474 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475 ELSE GOTO 220
475 loopSequence()
500 RETURN 0
700 RETURN 1
End Function
Function loopSequence() Uint64
10 IF EXISTS("Flop") THEN GOTO 50
20 flop()
30 STORE("Flop", 1)
40 GOTO 170
50 IF EXISTS("River") THEN GOTO 130
60 IF EXISTS("Turn") THEN GOTO 100
70 STORE("Turn", 1)
80 singleCard("TurnCard")
90 GOTO 170
100 singleCard("RiverCard")
110 STORE("River", 1)
120 GOTO 170
130 STORE("Reveal", 1)
140 DELETE("Turn")
150 DELETE("River")
160 DELETE("Bet")
170 STORE("Player:", LOAD("Dealer:"))
180 IF EXISTS(ITOA(LOAD("Dealer:"))+"F") THEN GOTO 190 ELSE GOTO 230
190 STORE("Player:", LOAD("Player:")+1)
200 IF EXISTS(ITOA(LOAD("Player:"))+"F") THEN GOTO 190
210 IF LOAD("Player:") == LOAD("Seats at Table:") THEN GOTO 220 ELSE GOTO 230
220 STORE("Player:", 0)
230 STORE("Counter:", 1)
240 DELETE("Wager:")
250 DELETE("W")
260 DELETE("Raised:")
270 RETURN 0
End Function
Function RevealKey(pcSeed String) Uint64
10 IF EXISTS("Reveal") THEN GOTO 30
20 RETURN 1
30 IF playerCheck() THEN GOTO 40 ELSE GOTO 20
40 clock()
50 STORE("Player"+ITOA(LOAD("Player:"))+"Key", pcSeed)
60 foldedLoop()
70 IF playerLoop() THEN GOTO 80 ELSE GOTO 100
80 STORE("Player:", 0)
90 foldedLoop()
100 IF counterLoop() THEN GOTO 110 ELSE GOTO 140
110 STORE("Counter:", 1)
120 STORE("End", 1)
130 DELETE("Reveal")
140 RETURN 0
End Function
Function ForceStart() Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("Player:", LOAD("Seats at Table:"))
40 MAPSTORE("Count", 0)
45 DIM s as Uint64
46 LET s = LOAD("Seats at Table:")
50 IF EXISTS("Player3 ID:") == 0 && s >= 3 THEN GOTO 60 ELSE GOTO 100
60 STORE("2SO", 1)
70 MAPSTORE("Count", 1)
80 STORE("Open", MAPGET("Count"))
90 STORE("2F", 1)
100 IF EXISTS("Player4 ID:") == 0 && s >= 4 THEN GOTO 110 ELSE GOTO 150
110 STORE("3SO", 1)
120 MAPSTORE("Count", MAPGET("Count")+1)
130 STORE("Open", MAPGET("Count"))
140 STORE("3F", 1)
150 IF EXISTS("Player5 ID:") == 0 && s >= 5 THEN GOTO 160 ELSE GOTO 200
160 STORE("4SO", 1)
170 MAPSTORE("Count", MAPGET("Count")+1)
180 STORE("Open", MAPGET("Count"))
190 STORE("4F", 1)
200 IF EXISTS("Player6 ID:") == 0 && s == 6 THEN GOTO 210 ELSE GOTO 250
210 STORE("5SO", 1)
220 MAPSTORE("Count", MAPGET("Count")+1)
230 STORE("Open", MAPGET("Count"))
240 STORE("5F", 1)
250 RETURN 0
End Function
Function CleanTable(amount Uint64) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF LOAD("Chips") == "ASSET" THEN GOTO 60
40 SEND_DERO_TO_ADDRESS(SIGNER(), amount)
50 GOTO 70
60 SEND_ASSET_TO_ADDRESS(SIGNER(), amount, LOAD("dReams"))
70 shuffleDeck()
80 RETURN 0
End Function
Function Deck(face String, back String) Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("Face:", face)
40 STORE("Back:", back)
50 RETURN 0
End Function
Function TimeOut() Uint64
10 IF LOAD("owner:") == SIGNER() THEN GOTO 30
20 RETURN 1
30 IF BLOCK_TIMESTAMP() > LOAD("Last")+45 THEN GOTO 45
40 RETURN 0
45 DIM p as Uint64
50 LET p = LOAD("Player:")
55 IF p == 0 THEN GOTO 40
56 openSpot()
60 takeBackCards(p+1)
70 STORE(ITOA(p)+"F", 1)
80 STORE(ITOA(p)+"SO", 1)
81 DELETE("Player"+ITOA(p+1))
82 DELETE("Player"+ITOA(p+1)+" ID:")
83 clock()
90 IF playerLoop() THEN GOTO 120
100 IF counterLoop() THEN GOTO 140
105 foldedLoop()
106 IF playerLoop() THEN GOTO 120
107 IF counterLoop() THEN GOTO 140
110 RETURN 0
120 STORE("Player:", 0)
130 foldedLoop()
140 IF counterLoop() && EXISTS("Bet") THEN GOTO 473
145 IF counterLoop() THEN GOTO 160
150 RETURN 0
160 STORE("Bet", 1)
170 STORE("Counter:", 1)
180 RETURN 0
473 IF EXISTS("W") THEN GOTO 474 ELSE GOTO 475
474 IF LOAD("W") >= LOAD("Seats at Table:") THEN GOTO 475 ELSE GOTO 500
475 loopSequence()
500 RETURN 0
End Function
Function playingWith() Uint64
10 IF LOAD("Chips") == "DERO" THEN GOTO 50
20 IF LOAD("Chips") == "ASSET" THEN GOTO 70
30 RETURN 12
50 IF ASSETVALUE(LOAD("dReams")) > 0 THEN GOTO 30
60 RETURN DEROVALUE()
70 IF DEROVALUE() > 0 THEN GOTO 30
80 RETURN ASSETVALUE(LOAD("dReams"))
End Function'] |