Microsoft Small Basic

Program Listing:
Embed this in your website
GraphicsWindow.Title = "poker"
GraphicsWindow.Width = 640
GraphicsWindow.Height = 480
GraphicsWindow.CanResize = "False"
GraphicsWindow.BackgroundColor = "LightGreen"

mojicolor = "Black"
bgcolor = "White"

GraphicsWindow.FontName = "Meiryo UI"

GraphicsWindow.FontSize = 50
GraphicsWindow.BrushColor = "DarkOliveGreen"
GraphicsWindow.DrawText(17, 7, "ポーカー")
GraphicsWindow.BrushColor = "MediumSeaGreen"
GraphicsWindow.DrawText(15, 5, "ポーカー")


GraphicsWindow.FontSize = 15
GraphicsWindow.BrushColor = mojicolor

trumpbutton = Controls.AddButton("ゲーム開始", 80, 20)
Controls.Move(trumpbutton, 280, 350)

strumpbutton = Controls.AddButton("再プレイ", 80, 20)
Controls.Move(strumpbutton, 280, 350)

koukan1button = Controls.AddButton("交換", 30, 20)
Controls.Move(koukan1button, 110, 250)

koukan2button = Controls.AddButton("交換", 30, 20)
Controls.Move(koukan2button, 210, 250)

koukan3button = Controls.AddButton("交換", 30, 20)
Controls.Move(koukan3button, 310, 250)

koukan4button = Controls.AddButton("交換", 30, 20)
Controls.Move(koukan4button, 410, 250)

koukan5button = Controls.AddButton("交換", 30, 20)
Controls.Move(koukan5button, 510, 250)

nokosu1button = Controls.AddButton("残す", 30, 20)
Controls.Move(nokosu1button, 110, 250)

nokosu2button = Controls.AddButton("残す", 30, 20)
Controls.Move(nokosu2button, 210, 250)

nokosu3button = Controls.AddButton("残す", 30, 20)
Controls.Move(nokosu3button, 310, 250)

nokosu4button = Controls.AddButton("残す", 30, 20)
Controls.Move(nokosu4button, 410, 250)

nokosu5button = Controls.AddButton("残す", 30, 20)
Controls.Move(nokosu5button, 510, 250)

kubarubutton = Controls.AddButton("配る", 30, 20)
Controls.Move(kubarubutton, 310, 290)

Controls.HideControl(koukan1button)
Controls.HideControl(koukan2button)
Controls.HideControl(koukan3button)
Controls.HideControl(koukan4button)
Controls.HideControl(koukan5button)
Controls.HideControl(nokosu1button)
Controls.HideControl(nokosu2button)
Controls.HideControl(nokosu3button)
Controls.HideControl(nokosu4button)
Controls.HideControl(nokosu5button)
Controls.HideControl(kubarubutton)
Controls.HideControl(strumpbutton)

Controls.ButtonClicked = trumpnarabe

Sub trumpnarabe
  Sound.PlayClick()
  If Controls.LastClickedButton = trumpbutton Then

    'トランプ10枚分ランダム作成
  trp:
  For i = 1 To 10
    number[i] = Math.GetRandomNumber(52)
  EndFor

  For x = 1 To 8
    For i = x To 9
      If (number[x] = number[i+1]) Then
        Goto trp
      EndIf
    EndFor
  EndFor

  nokosu1 = 0
  nokosu2 = 0
  nokosu3 = 0
  nokosu4 = 0
  nokosu5 = 0

  Controls.ShowControl(koukan1button)
  Controls.ShowControl(koukan2button)
  Controls.ShowControl(koukan3button)
  Controls.ShowControl(koukan4button)
  Controls.ShowControl(koukan5button)
  Controls.ShowControl(kubarubutton)
  Controls.HideControl(trumpbutton)

  For i = 1 To 5
    GraphicsWindow.BrushColor = bgcolor
    GraphicsWindow.FillRectangle(90+100*(i-1), 90, 80, 140)
  EndFor

  'トランプを5枚配置
  GraphicsWindow.FontSize =60
  For n = 1 To 5
    For x = 1 To 52
      If number[n] = x Then
        If 1 <= x And x <= 13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1a[n] = Shapes.AddText(Text.GetCharacter(9829))
          Shapes.Move(Pos1a[n], 100*n, 80)
        EndIf
        If 14 <= x And x <= 26 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1a[n] = Shapes.AddText(Text.GetCharacter(9830))
          Shapes.Move(Pos1a[n], 100*n, 80)
        EndIf
        If 27 <= x And x <= 39 Then
           GraphicsWindow.BrushColor = mojicolor
           Pos1a[n] = Shapes.AddText(Text.GetCharacter(9827))
           Shapes.Move(Pos1a[n], 100*n, 80)
        EndIf
        If 40 <= x And x <= 52 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1a[n] = Shapes.AddText(Text.GetCharacter(9824))
          Shapes.Move(Pos1a[n], 100*n, 80)
        EndIf
      If x=1 or x=1+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText("A")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=10 or x=10+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText("10")
          Shapes.Move(Pos1b[n], 100*n-11, 150)
        ElseIf x=11 or x=11+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText("J")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=12 or x=12+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText("Q")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=13 or x=13+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText("K")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=1+13*2 or x=1+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText("A")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=10+13*2 or x=10+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText("10")
          Shapes.Move(Pos1b[n], 100*n-11, 150)
        ElseIf x=11+13*2 or x=11+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText("J")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=12+13*2 or x=12+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText("Q")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        ElseIf x=13+13*2 or x=13+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText("K")
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        else
        If 1+1 <= x And x <= 13-4 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText(x)
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        EndIf
        If 14+1 <= x And x <= 26-4 Then
          GraphicsWindow.BrushColor = "Red"
          Pos1b[n] = Shapes.AddText(x-13)
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        EndIf
        If 27+1 <= x And x <= 39-4 Then
           GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText(x-13*2)
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        EndIf
        If 40+1 <= x And x <= 52-4 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos1b[n] = Shapes.AddText(x-13*3)
          Shapes.Move(Pos1b[n], 100*n+7, 150)
        EndIf
        EndIf
      EndIf
    EndFor
  EndFor
EndIf

If Controls.LastClickedButton = koukan1button Then
  Controls.HideControl(koukan1button)
  Controls.ShowControl(nokosu1button)
  nokosu1 = 1
EndIf

If Controls.LastClickedButton = koukan2button Then
  Controls.HideControl(koukan2button)
  Controls.ShowControl(nokosu2button)
  nokosu2 = 1
EndIf

If Controls.LastClickedButton = koukan3button Then
  Controls.HideControl(koukan3button)
  Controls.ShowControl(nokosu3button)
  nokosu3 = 1
EndIf

If Controls.LastClickedButton = koukan4button Then
  Controls.HideControl(koukan4button)
  Controls.ShowControl(nokosu4button)
  nokosu4 = 1
EndIf

If Controls.LastClickedButton = koukan5button Then
  Controls.HideControl(koukan5button)
  Controls.ShowControl(nokosu5button)
  nokosu5 = 1
EndIf

If Controls.LastClickedButton = nokosu1button Then
  Controls.ShowControl(koukan1button)
  Controls.HideControl(nokosu1button)
  nokosu1 = 0
EndIf

If Controls.LastClickedButton = nokosu2button Then
  Controls.ShowControl(koukan2button)
  Controls.HideControl(nokosu2button)
  nokosu2 = 0
EndIf

If Controls.LastClickedButton = nokosu3button Then
  Controls.ShowControl(koukan3button)
  Controls.HideControl(nokosu3button)
  nokosu3 = 0
EndIf

If Controls.LastClickedButton = nokosu4button Then
  Controls.ShowControl(koukan4button)
  Controls.HideControl(nokosu4button)
  nokosu4 = 0
EndIf

If Controls.LastClickedButton = nokosu5button Then
  Controls.ShowControl(koukan5button)
  Controls.HideControl(nokosu5button)
  nokosu5 = 0
EndIf

If Controls.LastClickedButton = kubarubutton Then
  'トランプ残り5枚を配置して、隠す
  GraphicsWindow.FontSize =60
  For n = 6 To 10
    For x = 1 To 52
      If number[n] = x Then
        If 1 <= x And x <= 13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2a[n-5] = Shapes.AddText(Text.GetCharacter(9829))
          Shapes.Move(Pos2a[n-5], 100*(n-5), 80)
        EndIf
        If 14 <= x And x <= 26 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2a[n-5] = Shapes.AddText(Text.GetCharacter(9830))
          Shapes.Move(Pos2a[n-5], 100*(n-5), 80)
        EndIf
        If 27 <= x And x <= 39 Then
           GraphicsWindow.BrushColor = mojicolor
           Pos2a[n-5] = Shapes.AddText(Text.GetCharacter(9827))
           Shapes.Move(Pos2a[n-5], 100*(n-5), 80)
        EndIf
        If 40 <= x And x <= 52 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2a[n-5] = Shapes.AddText(Text.GetCharacter(9824))
          Shapes.Move(Pos2a[n-5], 100*(n-5), 80)
        EndIf
      If x=1 or x=1+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText("A")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=10 or x=10+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText("10")
          Shapes.Move(Pos2b[n-5], 100*(n-5)-11, 150)
        ElseIf x=11 or x=11+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText("J")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=12 or x=12+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText("Q")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=13 or x=13+13 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText("K")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=1+13*2 or x=1+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText("A")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=10+13*2 or x=10+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText("10")
          Shapes.Move(Pos2b[n-5], 100*(n-5)-11, 150)
        ElseIf x=11+13*2 or x=11+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText("J")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=12+13*2 or x=12+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText("Q")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        ElseIf x=13+13*2 or x=13+13*3 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText("K")
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        else
        If 1+1 <= x And x <= 13-4 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText(x)
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        EndIf
        If 14+1 <= x And x <= 26-4 Then
          GraphicsWindow.BrushColor = "Red"
          Pos2b[n-5] = Shapes.AddText(x-13)
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        EndIf
        If 27+1 <= x And x <= 39-4 Then
           GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText(x-13*2)
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        EndIf
        If 40+1 <= x And x <= 52-4 Then
          GraphicsWindow.BrushColor = mojicolor
          Pos2b[n-5] = Shapes.AddText(x-13*3)
          Shapes.Move(Pos2b[n-5], 100*(n-5)+7, 150)
        EndIf
        EndIf
      EndIf
    EndFor
  EndFor

  Controls.HideControl(Pos2a[1])
  Controls.HideControl(Pos2a[2])
  Controls.HideControl(Pos2a[3])
  Controls.HideControl(Pos2a[4])
  Controls.HideControl(Pos2a[5])
  Controls.HideControl(Pos2b[1])
  Controls.HideControl(Pos2b[2])
  Controls.HideControl(Pos2b[3])
  Controls.HideControl(Pos2b[4])
  Controls.HideControl(Pos2b[5])
  Controls.HideControl(koukan1button)
  Controls.HideControl(koukan2button)
  Controls.HideControl(koukan3button)
  Controls.HideControl(koukan4button)
  Controls.HideControl(koukan5button)
  Controls.HideControl(nokosu1button)
  Controls.HideControl(nokosu2button)
  Controls.HideControl(nokosu3button)
  Controls.HideControl(nokosu4button)
  Controls.HideControl(nokosu5button)
  Controls.HideControl(kubarubutton)

  If nokosu1 = 0 Then
    Controls.HideControl(Pos1a[1])
    Controls.HideControl(Pos1b[1])
    Controls.ShowControl(Pos2a[1])
    Controls.ShowControl(Pos2b[1])
    number[1] = number[6]
  EndIf

  If nokosu2 = 0 Then
    Controls.HideControl(Pos1a[2])
    Controls.HideControl(Pos1b[2])
    Controls.ShowControl(Pos2a[2])
    Controls.ShowControl(Pos2b[2])
    number[2] = number[7]
  EndIf

  If nokosu3 = 0 Then
    Controls.HideControl(Pos1a[3])
    Controls.HideControl(Pos1b[3])
    Controls.ShowControl(Pos2a[3])
    Controls.ShowControl(Pos2b[3])
    number[3] = number[8]
  EndIf

  If nokosu4 = 0 Then
    Controls.HideControl(Pos1a[4])
    Controls.HideControl(Pos1b[4])
    Controls.ShowControl(Pos2a[4])
    Controls.ShowControl(Pos2b[4])
    number[4] = number[9]
  EndIf

  If nokosu5 = 0 Then
    Controls.HideControl(Pos1a[5])
    Controls.HideControl(Pos1b[5])
    Controls.ShowControl(Pos2a[5])
    Controls.ShowControl(Pos2b[5])
    number[5] = number[10]
  EndIf

  GraphicsWindow.FontSize =20
  GraphicsWindow.BrushColor = mojicolor

  getnumber = "," + number[1] + "," + number[2] + "," + number[3] + "," + number[4] + "," + number[5]+ ","

  For i=1 To 5
    trumpnumber[i] = Math.Remainder(number[i], 13)
    If trumpnumber[i] = 0 Then
      trumpnumber[i] = 13
    EndIf
  EndFor
  getnumber2 = "," + trumpnumber[1] + "," + trumpnumber[2] + "," + trumpnumber[3] + "," + trumpnumber[4] + "," + trumpnumber[5]+ ","

  GraphicsWindow.FontSize =50
  GraphicsWindow.BrushColor = mojicolor

'ロイヤルストレートフラッシュ
  If Text.IsSubText(getnumber, ",1,") And Text.IsSubText(getnumber, ",10,") And Text.IsSubText(getnumber, ",11,") And Text.IsSubText(getnumber, ",12,") And Text.IsSubText(getnumber, ",13,") Then
    GraphicsWindow.DrawText(200, 240, "ロイヤルストレートフラッシュ!")
    Controls.ShowControl(strumpbutton)
  ElseIf Text.IsSubText(getnumber, ",14,") And Text.IsSubText(getnumber, ",23,") And Text.IsSubText(getnumber, ",24,") And Text.IsSubText(getnumber, ",25,") And Text.IsSubText(getnumber, ",26,") Then
    GraphicsWindow.DrawText(200, 240, "ロイヤルストレートフラッシュ!")
    Controls.ShowControl(strumpbutton)
  ElseIf Text.IsSubText(getnumber, ",27,") And Text.IsSubText(getnumber, ",36,") And Text.IsSubText(getnumber, ",37,") And Text.IsSubText(getnumber, ",38,") And Text.IsSubText(getnumber, ",39,") Then
    GraphicsWindow.DrawText(200, 240, "ロイヤルストレートフラッシュ!")
    Controls.ShowControl(strumpbutton)
  ElseIf Text.IsSubText(getnumber, ",40,") And Text.IsSubText(getnumber, ",49,") And Text.IsSubText(getnumber, ",50,") And Text.IsSubText(getnumber, ",51,") And Text.IsSubText(getnumber, ",52,") Then
    GraphicsWindow.DrawText(200, 240, "ロイヤルストレートフラッシュ!")
    Controls.ShowControl(strumpbutton)
  Else
    strfl()
  EndIf
EndIf

If Controls.LastClickedButton = strumpbutton Then
    Controls.HideControl(Pos1a[1])
    Controls.HideControl(Pos1b[1])
    Controls.HideControl(Pos2a[1])
    Controls.HideControl(Pos2b[1])
    Controls.HideControl(Pos1a[2])
    Controls.HideControl(Pos1b[2])
    Controls.HideControl(Pos2a[2])
    Controls.HideControl(Pos2b[2])
    Controls.HideControl(Pos1a[3])
    Controls.HideControl(Pos1b[3])
    Controls.HideControl(Pos2a[3])
    Controls.HideControl(Pos2b[3])
    Controls.HideControl(Pos1a[4])
    Controls.HideControl(Pos1b[4])
    Controls.HideControl(Pos2a[4])
    Controls.HideControl(Pos2b[4])
    Controls.HideControl(Pos1a[5])
    Controls.HideControl(Pos1b[5])
    Controls.HideControl(Pos2a[5])
    Controls.HideControl(Pos2b[5])
    Controls.ShowControl(trumpbutton)
    Controls.HideControl(strumpbutton)
  GraphicsWindow.BrushColor = "LightGreen"
  GraphicsWindow.FillRectangle(200, 240, 400, 100)
EndIf
EndSub

Sub strfl
  'ストレートフラッシュ
  min1_2 = Math.Min(number[1], number[2])
  min3_4 = Math.Min(number[2], number[3])
  min1_2_3_4 = Math.Min(min1_2, min3_4)
  minn = Math.Min(min1_2_3_4, number[5])
  For i = 0 to 4
    min[i] = minn + i
  EndFor
  If (1 <= min[0] and min[0] <= 9) Or (1+13 <= min[0] and min[0] <= 9+13) Or (1+13*2 <= min[0] and min[0] <= 9+13*2) Or (1+13*3 <= min[0] and min[0] <= 9+13*3) Then
    If Text.IsSubText(getnumber, ","+min[0]+",") and Text.IsSubText(getnumber, ","+min[1]+",") and Text.IsSubText(getnumber, ","+min[2]+",") and Text.IsSubText(getnumber, ","+min[3]+",") and Text.IsSubText(getnumber, ","+min[4]+",") Then
      GraphicsWindow.DrawText(150, 240, "ストレートフラッシュ!")
      Controls.ShowControl(strumpbutton)
      Else
    fourcard()
    EndIf
  Else
    fourcard()
  EndIf
EndSub

Sub fourcard
'フォーカード
  If (trumpnumber[1] = trumpnumber[2]) And (trumpnumber[1] = trumpnumber[3]) And (trumpnumber[1] = trumpnumber[4]) Then
    GraphicsWindow.DrawText(200, 240, "フォーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[2]) And (trumpnumber[1] = trumpnumber[3]) And (trumpnumber[1] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フォーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[2]) And (trumpnumber[1] = trumpnumber[4]) And (trumpnumber[1] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フォーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[3]) And (trumpnumber[1] = trumpnumber[4]) And (trumpnumber[1] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フォーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[2] = trumpnumber[3]) And (trumpnumber[2] = trumpnumber[4]) And (trumpnumber[2] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フォーカード!")
    Controls.ShowControl(strumpbutton)
  Else
    fullhouse()
  EndIf
EndSub

Sub fullhouse
'フルハウス
  If (trumpnumber[1] = trumpnumber[2]) And (trumpnumber[1] = trumpnumber[3]) And (trumpnumber[4] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[2]) And (trumpnumber[1] = trumpnumber[4]) And (trumpnumber[3] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[2]) And (trumpnumber[1] = trumpnumber[5]) And (trumpnumber[3] = trumpnumber[4]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[3]) And (trumpnumber[1] = trumpnumber[4]) And (trumpnumber[2] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[3]) And (trumpnumber[1] = trumpnumber[5]) And (trumpnumber[2] = trumpnumber[4]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[1] = trumpnumber[4]) And (trumpnumber[1] = trumpnumber[5]) And (trumpnumber[2] = trumpnumber[3]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[2] = trumpnumber[3]) And (trumpnumber[2] = trumpnumber[4]) And (trumpnumber[1] = trumpnumber[5]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[2] = trumpnumber[3]) And (trumpnumber[2] = trumpnumber[5]) And (trumpnumber[1] = trumpnumber[4]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[2] = trumpnumber[4]) And (trumpnumber[2] = trumpnumber[5]) And (trumpnumber[1] = trumpnumber[3]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  ElseIf (trumpnumber[3] = trumpnumber[4]) And (trumpnumber[3] = trumpnumber[5]) And (trumpnumber[1] = trumpnumber[2]) Then
    GraphicsWindow.DrawText(200, 240, "フルハウス!")
    Controls.ShowControl(strumpbutton)
  Else
    flush()
  EndIf
EndSub

Sub flush
  'フラッシュ
  If 1 <= number[1] And number[1] <=13 And 1 <= number[2] And number[2] <=13 And 1 <= number[3] And number[3] <=13 And 1 <= number[4] And number[4] <=13 And 1 <= number[5] And number[5] <=13 Then
    GraphicsWindow.DrawText(200, 240, "フラッシュ!")
    Controls.ShowControl(strumpbutton)
  ElseIf 1+13 <= number[1] And number[1] <=13+13 And 1+13 <= number[2] And number[2] <=13+13 And 1+13 <= number[3] And number[3] <=13+13 And 1+13 <= number[4] And number[4] <=13+13 And 1+13 <= number[5] And number[5] <=13+13 Then
    GraphicsWindow.DrawText(200, 240, "フラッシュ!")
    Controls.ShowControl(strumpbutton)
  ElseIf 1+13*2 <= number[1] And number[1] <=13+13*2 And 1+13*2 <= number[2] And number[2] <=13+13*2 And 1+13*2 <= number[3] And number[3] <=13+13*2 And 1+13*2 <= number[4] And number[4] <=13+13*2 And 1+13*2 <= number[5] And number[5] <=13+13*2 Then
    GraphicsWindow.DrawText(200, 240, "フラッシュ!")
    Controls.ShowControl(strumpbutton)
  ElseIf 1+13*3 <= number[1] And number[1] <=13+13*3 And 1+13*3 <= number[2] And number[2] <=13+13*3 And 1+13*3 <= number[3] And number[3] <=13+13*3 And 1+13*3 <= number[4] And number[4] <=13+13*3 And 1+13*3 <= number[5] And number[5] <=13+13*3 Then
    GraphicsWindow.DrawText(200, 240, "フラッシュ!")
    Controls.ShowControl(strumpbutton)
  Else
    Strt()
  EndIf
EndSub

Sub Strt
  'ストレート
  Max1_2 = Math.Max(trumpnumber[1], trumpnumber[2])
  Max3_4 = Math.Max(trumpnumber[2], trumpnumber[3])
  Max1_2_3_4 = Math.Max(Max1_2, Max3_4)
  Maxn = Math.Max(Max1_2_3_4, trumpnumber[5])
  For i = 0 to 4
    Max[i] = Maxn - i
  EndFor
  If (5 <= Max[0] and Max[0] <= 13) Then
   If Text.IsSubText(getnumber2, ","+Max[0]+",") and Text.IsSubText(getnumber2, ","+Max[1]+",") and Text.IsSubText(getnumber2, ","+Max[2]+",") and Text.IsSubText(getnumber2, ","+Max[3]+",") and Text.IsSubText(getnumber2, ","+Max[4]+",") Then
     GraphicsWindow.DrawText(200, 240, "ストレート!")
     Controls.ShowControl(strumpbutton)
   Else
     threecard()
   EndIf
  Else
    threecard()
  EndIf
EndSub

Sub threecard
  'スリーカード
  If trumpnumber[1] =trumpnumber[2] And trumpnumber[1] = trumpnumber[3] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[2] And trumpnumber[1] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[2] And trumpnumber[1] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[3] And trumpnumber[3] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[3] And trumpnumber[3] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[4] And trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[2] = trumpnumber[3] And trumpnumber[3] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[2] = trumpnumber[3] And trumpnumber[3] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[2] = trumpnumber[4] And trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[3] = trumpnumber[4] And trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "スリーカード!")
    Controls.ShowControl(strumpbutton)
  Else
    twopair()
  EndIf
EndSub

Sub twopair
  'ツーペア
  If trumpnumber[1] =trumpnumber[2] And trumpnumber[3] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[2] And trumpnumber[3] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[2] And trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[3] And trumpnumber[2] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[3] And trumpnumber[2] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[3] And trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[4] And trumpnumber[2] = trumpnumber[3] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[4] And trumpnumber[2] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[4] And trumpnumber[3] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[5] And trumpnumber[2] = trumpnumber[3] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[5] And trumpnumber[2] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[1] = trumpnumber[5] And trumpnumber[3] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  ElseIf trumpnumber[2] = trumpnumber[3] And trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ツーペア!")
    Controls.ShowControl(strumpbutton)
  Else
    onepair()
  EndIf
EndSub

Sub onepair
  'ワンペア
  If trumpnumber[1] =trumpnumber[2] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[1] = trumpnumber[3] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[1] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[1] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[2] = trumpnumber[3] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[2] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[2] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[3] = trumpnumber[4] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[3] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  ElseIf trumpnumber[4] = trumpnumber[5] Then
    GraphicsWindow.DrawText(200, 240, "ワンペア!")
  Else
    GraphicsWindow.DrawText(200, 240, "負け……。")
  EndIf
  Controls.ShowControl(strumpbutton)
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.