@Elijuneau of course! Below is the code for both Black Jack and Tic Tac Toe (even though I assume you were talking about ttt). Apologies for how disorganized everything is. If you have any questions, feel free to DM me.

Best of luck with your game!!!

##
Tic Tac Toe

*label paul_start

*temp dieroll 0

*temp myPlayer “O”

*temp PaulPlayer “X”

*gosub ttt_main

*return

*label l_start

*temp dieroll 1

*temp myPlayer “X”

*temp PaulPlayer “O”

*goto ttt_main

*label ttt_main

*temp selection 0

*temp s_1 “1”

*temp s_2 “2”

*temp s_3 “3”

*temp s_4 “4”

*temp s_5 “5”

*temp s_6 “6”

*temp s_7 “7”

*temp s_8 “8”

*temp s_9 “9”

*temp tcount_1 1

*temp tcount_2 1

*temp tcount_3 1

*temp tcount_4 1

*temp tcount_5 1

*temp tcount_6 1

*temp tcount_7 1

*temp tcount_8 1

*temp tcount_9 1

*temp status_1 “-2”

*temp status_2 “-2”

*temp status_3 “-2”

*temp status_4 “-2”

*temp status_5 “-2”

*temp status_6 “-2”

*temp status_7 “-2”

*temp status_8 “-2”

*temp status_9 “-2”

*temp best_1 “-2”

*temp best_2 “-2”

*temp best_3 “-2”

*temp best_4 “-2”

*temp best_5 “-2”

*temp best_6 “-2”

*temp best_7 “-2”

*temp best_8 “-2”

*temp best_9 “-2”

*temp best “none”

*temp tplayer “X”

*temp status “tie”

*temp avail 9

*temp board “123456789”

*temp scrabbleBoard “276951438”

*temp scrabbleVal “”

*temp pPicks “”

*temp lPicks “”

*temp gameMessage “”

*temp default

*temp myspace

*temp best

*temp mycount

*temp mystatus

*temp mybest

*temp firstMove true

*goto tictactoe

*label switchPlayer

*if (tplayer = “X”)

*set tplayer “O”

*else

*set tplayer “X”

*return

*label testQuickWin

*label itestQuickWin

*if ({mycount} > 9)

*return

*set myspace “s_${{mycount}}”

*if (({myspace} != “X”) and ({myspace} != “O”))

*set {myspace} tplayer

*set mycount “tcount_${avail}”

*set mystatus “status_${avail}”

*set mybest “best_${avail}”

*set default {mycount}

*set myspace “s_${{mycount}}”

*gosub check_board

*if (status = tplayer)

*set {mystatus} status

*set {mybest} {mycount}

*set {mycount} 10

*set {myspace} “${{default}}”

*set {mycount} + 1

*goto itestQuickWin

*return

*label testMoves

*label itestMoves

*if ({mycount} > 9)

*return

*set myspace “s_${{mycount}}”

*if (({myspace} != “X”) and ({myspace} != “O”))

*set {myspace} tplayer

*gosub switchPlayer

*set avail - 1

*gosub move

*set avail + 1

*gosub switchPlayer

*set mycount “tcount_${avail}”

*set mystatus “status_${avail}”

*set mybest “best_${avail}”

*set default {mycount}

*set myspace “s_${{mycount}}”

*if ({mystatus} = “-2”)

*set {mystatus} status

*set {mybest} {mycount}

*if (status = tplayer)

*set {mystatus} status

*set {mybest} {mycount}

*set {mycount} 10

*else

*if (status = “-1”)

*set {mystatus} status

*set {mybest} {mycount}

*if ((dieroll = 1) and (tplayer = “O”))

*comment Paul will settle for a tie if he goes second

*set {mycount} 10

*set {myspace} “${{default}}”

*set {mycount} + 1

*goto itestMoves

*return

*label move

*gosub check_board

*if ((status != “tie”) or (avail < 1))

*return

*set best “-1”

*set mycount “tcount_${avail}”

*set mystatus “status_${avail}”

*set {mystatus} “-2”

*set mybest “best_${avail}”

*set {“tcount_${avail}”} “1”

*gosub testQuickWin

*if ((status != “tie”) or (avail < 1))

*set status {mystatus}

*set best {mybest}

*return

*set best “-1”

*set mycount “tcount_${avail}”

*set mystatus “status_${avail}”

*set {mystatus} “-2”

*set mybest “best_${avail}”

*set {“tcount_${avail}”} “1”

*gosub testMoves

*set status {mystatus}

*set best {mybest}

*return

*label check_board

*set status “tie”

*if ((s_1 = s_2) and (s_2 = s_3))

*set status s_1

*set gameMessage “${scrabbleBoard#1} + ${scrabbleBoard#2} + ${scrabbleBoard#3} = 15.”

*elseif ((s_4 = s_5) and (s_5 = s_6))

*set status s_4

*set gameMessage “${scrabbleBoard#4} + ${scrabbleBoard#5} + ${scrabbleBoard#6} = 15.”

*elseif ((s_7 = s_8) and (s_8 = s_9))

*set status s_7

*set gameMessage “${scrabbleBoard#7} + ${scrabbleBoard#8} + ${scrabbleBoard#9} = 15.”

*elseif ((s_1 = s_4) and (s_4 = s_7))

*set status s_1

*set gameMessage “${scrabbleBoard#1} + ${scrabbleBoard#4} + ${scrabbleBoard#7} = 15.”

*elseif ((s_2 = s_5) and (s_5 = s_8))

*set status s_2

*set gameMessage “${scrabbleBoard#2} + ${scrabbleBoard#5} + ${scrabbleBoard#8} = 15.”

*elseif ((s_3 = s_6) and (s_6 = s_9))

*set status s_3

*set gameMessage “${scrabbleBoard#3} + ${scrabbleBoard#6} + ${scrabbleBoard#9} = 15.”

*elseif ((s_1 = s_5) and (s_5 = s_9))

*set status s_1

*set gameMessage “${scrabbleBoard#1} + ${scrabbleBoard#5} + ${scrabbleBoard#9} = 15.”

*elseif ((s_3 = s_5) and (s_5 = s_7))

*set status s_3

*set gameMessage “${scrabbleBoard#3} + ${scrabbleBoard#5} + ${scrabbleBoard#7} = 15.”

*elseif (avail < 1)

*set status “-1”

*return

*label get_icon

*if icount > 9

*return

*else

*temp space “s_${icount}”

*temp vacant “space_${scrabbleBoard#icount}.png”

*if ( {space} = “X” )

*image x.png left

*elseif ( {space} = “O” )

*image o.png left

*else

*image ${vacant} left

*if ( ( icount modulo 3 ) = 0 )

*image Spacer.gif center

*set icount + 1

*gosub get_icon

*return

*label drawSimple

*temp emptySpaces “”

*temp delim “”

*if (s_6 = 6)

*set emptySpaces “${emptySpaces}${delim}1”

*set delim ", "

*if (s_1 = 1)

*set emptySpaces “${emptySpaces}${delim}2”

*set delim ", "

*if (s_8 = 8)

*set emptySpaces “${emptySpaces}${delim}3”

*set delim ", "

*if (s_7 = 7)

*set emptySpaces “${emptySpaces}${delim}4”

*set delim ", "

*if (s_5 = 5)

*set emptySpaces “${emptySpaces}${delim}5”

*set delim ", "

*if (s_3 = 3)

*set emptySpaces “${emptySpaces}${delim}6”

*set delim ", "

*if (s_2 = 2)

*set emptySpaces “${emptySpaces}${delim}7”

*set delim ", "

*if (s_9 = 9)

*set emptySpaces “${emptySpaces}${delim}8”

*set delim ", "

*if (s_4 = 4)

*set emptySpaces “${emptySpaces}${delim}9”

*set delim ", "

Available moves are: ${emptySpaces}

*return

*label drawboard

*if (lPicks != “”)

You have selected: ${lPicks}

*if (pPicks != “”)

Paul has selected: ${pPicks}

*if (TTT_Easy = false)

*comment draw simple board

*gosub drawSimple

*else

*gosub get_board

*temp icount 1

*gosub get_icon

*return

*label get_board

*set board “${s_1}${s_2}${s_3}${s_4}${s_5}${s_6}${s_7}${s_8}${s_9}”

*return

*label check_status

*gosub get_board

*gosub check_board

*return

*label move_O

*comment Speeding up decision on player first move response (optional performance enhancement)

*if ((firstMove = true) and (dieroll = 1))

*comment Set number of places for Paul to move

*if (s_5 = myPlayer)

*set best “9”

*else

*set best “5”

*elseif ((firstMove = true) and (dieroll = 0))

*if (s_5 = myPlayer)

*if (s_9 = PaulPlayer)

*set best “8”

*else

*set best “9”

*elseif (s_1 = PaulPlayer)

*if ((s_6 = myPlayer) or ((s_8 = myPlayer) or (s_9 = myPlayer)))

*set best “3”

*elseif ((s_4 = myPlayer) or (s_7 = myPlayer))

*set best “2”

*else

*set best “4”

*elseif (s_3 = PaulPlayer)

*if (s_1 = myPlayer)

*set best “6”

*elseif (s_2 = myPlayer)

*set best “5”

*else

*set best “1”

*elseif (s_7 = PaulPlayer)

*if (s_1 = myPlayer)

*set best “3”

*elseif (s_4 = myPlayer)

*set best “5”

*else

*set best “1”

*elseif (s_9 = PaulPlayer)

*if (s_6 = myPlayer)

*set best “5”

*elseif ((s_3 = myPlayer) or (s_7 = myPlayer))

*set best “1”

*else

*set best “3”

*else

*set tplayer PaulPlayer

*gosub move

*if (firstMove = true)

*set firstMove false

*gosub check_board

*label set_space

*temp status_space “s_${best}”

*set {status_space} PaulPlayer

*set scrabbleVal “${scrabbleBoard#best}”

*set pPicks “${pPicks} ${scrabbleVal}”

*return

*label tictactoe

*if (dieroll = 0)

Paul goes first.

*if (dieroll = 1)

You go first.

*set status “tie”

*set s_1 “1”

*set s_2 “2”

*set s_3 “3”

*set s_4 “4”

*set s_5 “5”

*set s_6 “6”

*set s_7 “7”

*set s_8 “8”

*set s_9 “9”

*if (dieroll = 0)

*temp corner 1

*rand corner 1 4

*if (corner = 1)

*set best 1

*elseif (corner = 2)

*set best 3

*elseif (corner = 3)

*set best 7

*elseif (corner = 4)

*set best 9

*gosub set_space

*set avail (avail - 1)

*label start

*gosub drawboard

*gosub check_status

*if (status != “tie”)

*goto over

Which number would you like to select?

*set avail (avail - 1)

*fake_choice

*selectable_if (s_6 = 6) #Pick number 1

*set selection 1

*set s_6 myPlayer

*selectable_if (s_1 = 1) #Pick number 2

*set selection 2

*set s_1 myPlayer

*selectable_if (s_8 = 8) #Pick number 3

*set selection 3

*set s_8 myPlayer

*selectable_if (s_7 = 7) #Pick number 4

*set selection 4

*set s_7 myPlayer

*selectable_if (s_5 = 5) #Pick number 5

*set selection 5

*set s_5 myPlayer

*selectable_if (s_3 = 3) #Pick number 6

*set selection 6

*set s_3 myPlayer

*selectable_if (s_2 = 2) #Pick number 7

*set selection 7

*set s_2 myPlayer

*selectable_if (s_9 = 9) #Pick number 8

*set selection 8

*set s_9 myPlayer

*selectable_if (s_4 = 4) #Pick number 9

*set selection 9

*set s_4 myPlayer

*set lPicks “${lPicks} ${selection}”

*gosub check_status

*if (status = “tie”)

*gosub move_O

*set avail (avail - 1)

*goto start

*label over

*if (status = myPlayer)

You win. ${gameMessage}

*bug THIS SHOULD NEVER HAPPEN

*set TTT_Result “win”

*return

*if (status = “-1”)

You tied.

*set TTT_Result “tie”

*return

*set TTT_Result “lose”

You lose. ${gameMessage}

*return

##
Black Jack

*label init_game

*temp cards bj_deck

*temp P “”

*temp L “”

*temp P_score 0

*temp L_score 0

*temp status “tie”

*temp message “”

*temp remaining bj_remaining

*temp wins bj_wins

*temp losses bj_losses

*temp ties bj_ties

*temp count 0

*temp fdeck “”

*temp prob “”

*temp suits “CHDS”

*temp P_len 0

*temp L_len 0

*temp reveal_hidden false

*temp cvals “AC2C3C4C5C6C7C8C9C0CJCKCQC”

*temp hvals “AH2H3H4H5H6H7H8H9H0HJHKHQH”

*temp dvals “AD2D3D4D5D6D7D8D9D0DJDKDQD”

*temp svals “AS2S3S4S5S6S7S8S9S0SJSKSQS”

*temp fdeck “0000000000000”

*temp card_types “A234567890JQK”

*temp cA_val 1

*temp c2_val 2

*temp c3_val 3

*temp c4_val 4

*temp c5_val 5

*temp c6_val 6

*temp c7_val 7

*temp c8_val 8

*temp c9_val 9

*temp c0_val 10

*temp cJ_val 10

*temp cK_val 10

*temp cQ_val 10

*temp selected_card “”

*goto start_bj

*label init_deck

*set cards “${cvals}${hvals}${dvals}${svals}”

*set fdeck “0000000000000”

*set cA_freq 0

*set c2_freq 0

*set c3_freq 0

*set c4_freq 0

*set c5_freq 0

*set c6_freq 0

*set c7_freq 0

*set c8_freq 0

*set c9_freq 0

*set c0_freq 0

*set cJ_freq 0

*set cK_freq 0

*set cQ_freq 0

*set P_len 0

*set L_len 0

*return

*label calculate_prob

*temp score L_score

*temp tlen remaining

*temp mywins 0

*label icalculate_prob

*if (tlen > 0)

*temp index (tlen * 2) - 1

*temp card “c${cards#index}_val”

*if ((score + {card}) > 21)

*set mywins + 1

*set tlen - 1

*goto icalculate_prob

*if (remaining > 0)*

[i]Probability of bust on the next hit: ${round((mywins100)/remaining)}%[/i]

*else

Probability of bust on the next hit: 0 (no remaining cards)

*return

*label print_deck

*temp tlen 13

*label iprint_deck

*if (tlen > 0)

*temp freq “c${card_types#tlen}_freq”

${card_types#tlen}:${{freq}}

*set tlen - 1

*goto iprint_deck

*line_break

*return

*label select_card

*temp cindex

*rand cindex 1 remaining

*temp tcard (cindex * 2) - 1

*temp tsuit tcard + 1

*temp icard

*temp isuit

*temp tlen remaining

*temp tcards “”

*set remaining - 1

*set selected_card “${cards#tcard}${cards#tsuit}”

*temp fcard “c${cards#tcard}_freq”

*set {fcard} + 1

*label remove_selected

*if (tlen > 0)

*set icard (tlen * 2) - 1

*set isuit icard + 1

*if (icard != tcard)

*set tcards “${tcards}${cards#icard}${cards#isuit}”

*set tlen - 1

*goto remove_selected

*set cards tcards

*return

*label deal_cards

*gosub select_card

*temp c1 selected_card

*gosub select_card

*temp c2 selected_card

*gosub select_card

*temp c3 selected_card

*gosub select_card

*temp c4 selected_card

*set L “${c1}${c2}”

*set P “${c3}${c4}”

*set L_len + 2

*set P_len + 2

*return

*label print_cards

Paul’s cards:

*temp ipcards P_len

*temp firstCard true

*label ipprint

*if (ipcards > 0)

*temp ipcard (2*ipcards) - 1

*temp ipsuit ipcard + 1

*temp pcard “i${P#ipcard}${P#ipsuit}”

```
*if ((firstCard and not(reveal_hidden)) and (status = "tie"))
*image blankCard.png left
*else
*image ${pcard}.png left
*set ipcards - 1
*set firstCard false
*goto ipprint
```

*image Spacer.gif center

Your cards:

*temp ilcards L_len

*label ilprint

*if (ilcards > 0)

*temp ilcard (2*ilcards) - 1

*temp ilsuit ilcard + 1

*temp lcard “i${L#ilcard}${L#ilsuit}”

*image ${lcard}.png left

*set ilcards - 1

*goto ilprint

*line_break

*line_break

*line_break

*line_break

*return

*label display_cards

*gosub print_cards

*return

*label get_player_scores

*temp tplen P_len

*temp pscore 0

*temp pace false

*label ipauldeck

*if (tplen > 0)

*temp icard (tplen * 2) - 1

*temp ival “c${P#icard}_val”

*if (“${P#icard}” = “A”)

*set pace true

*set pscore + {ival}

*set tplen - 1

*goto ipauldeck

*if ((pace = true) and ((pscore + 10) <= 21))

*set pscore + 10

*set P_score pscore

*temp tllen L_len

*temp lscore 0

*temp lace false

*label ilenoredeck

*if (tllen > 0)

*temp icard (tllen * 2) - 1

*temp ival “c${L#icard}_val”

*if (“${L#icard}” = “A”)

*set lace true

*set lscore + {ival}

*set tllen - 1

*goto ilenoredeck

*if ((lace = true) and ((lscore + 10) <= 21))

*set lscore + 10

*set L_score lscore

*return

*label reveal_card

*set reveal_hidden true

*return

*label display_score

*gosub get_player_scores

Your current score is ${L_score}. Would you like to hit or stand?

*if (bj_advantage = “logic”)

*gosub calculate_prob

*return

*label dealer_move

*gosub get_player_scores

*label idealer_move

*if ((P_score < 17) and (remaining > 0))

*gosub select_card

*set P “${P}${selected_card}”

*set P_len + 1

*gosub get_player_scores

*goto idealer_move

*return

*label get_BJ_winner

*gosub get_player_scores

*if ((L_score > 21) and (P_score <= 21))

*set status “P”

*set message “You went over 21. Paul wins.”

*elseif ((P_score > 21) and (L_score <= 21))

*set status “L”

*set message “You win.”

*elseif ((P_score > 21) and (L_score > 21))

*set status “-1”

*set message “Both players > 21. Tie.”

*elseif (L_score = P_score)

*set status “-1”

*set message “Tie.”

*elseif (P_score > L_score)

*set status “P”

*set message “Paul wins.”

*elseif (L_score > P_score)

*set status “L”

*set message “You win.”

*return

*label check_bust

*gosub get_player_scores

*if (L_score > 21)

*set status “P”

*set message “You busted! Paul wins.”

*return

*label check_BJ

*gosub get_player_scores

*if ((L_score = 21) and (P_score = 21))

*set status “-1”

*set message “Both players have 21. Tie.”

*elseif (P_score = 21)

*set status “P”

*set message “Paul has 21. You lose.”

*elseif (L_score = 21)

*set status “L”

*set message “You have 21. You win.”

*return

*label start_bj

*if (cards = “”)

*gosub init_deck

*gosub deal_cards

*temp firstgame true

*label start

*if (firstgame = true)

*gosub check_BJ

*set firstgame false

*set reveal_hidden false

*if (status = “-1”)

*if (bj_advantage = “creativity”)

*set wins + 1

*else

*set ties + 1

*elseif (status = “L”)

*set wins + 1

*elseif (status = “P”)

*set losses + 1

Remaining cards: ${remaining}, Wins: ${wins}, Losses: ${losses}, Ties: ${ties}

*line_break

*line_break

*if (bj_advantage = “honesty”)

*gosub print_deck

*if (bj_advantage = “deception”)

*gosub reveal_card

*gosub display_cards

*if (status != “tie”)

*goto over

*gosub display_score

*choice

*selectable_if ((remaining > 0) and (L_score < 21)) #Hit me!

*gosub select_card

*set L “${L}${selected_card}”

*set L_len + 1

*gosub check_bust

*goto start

```
#Stand
*gosub dealer_move
*gosub get_BJ_winner
*goto start
```

*label over

*gosub reveal_card

${message}

*set bj_status status

*set bj_deck cards

*set bj_wins wins

*set bj_losses losses

*set bj_ties ties

*set bj_remaining remaining

*return

*if (remaining >= 4)

Do you want to go another round with Paul?

*fake_choice

#Deal me in!

*gosub deal_cards

*set firstgame true

*set status “tie”

*set message “”

*goto start

#No thanks.

*set bj_deck cards

*set bj_wins wins

*set bj_losses losses

*set bj_ties ties

*set bj_remaining remaining

*return

*else

*gosub init_deck

*fake_choice

*if (wins > losses) #Out of cards. I won ${wins} hands compared to Paul’s ${losses}. Time to rub my victory in his face.

*set bj_winner “L”

*if (wins < losses) #Out of cards. Paul won ${losses} hands compared to my ${wins}. Time to accept my defeat.

*set bj_winner “P”

*if (wins = losses) #Out of cards. And since Paul and I each won a total of ${wins} hands, he won’t be able to talk any smack.

*set bj_winner “T”

*set bj_deck cards

*set bj_wins 0

*set bj_losses 0

*set bj_ties 0

*set bj_remaining 0

*return