Guidance
指路人
g.yi.org
software / rapidq / Examples / Game / magic Number / magicNumber.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' MagicNumber.bas for RapidQ
' Coded by Gérald VERDIER - BinoclaR (°-°) software
' october 2003
' email : gerald.verdier@club-internet.fr
' PURPOSE : the computer find your number among 16 numbers

'0000 = 14
'0001 = 10
'0010 = 16
'0011 = 12

'0100 = 13
'0101 = 09
'0110 = 15
'0111 = 11

'1000 = 06
'1001 = 02
'1010 = 08
'1011 = 04

'1100 = 05
'1101 = 01
'1110 = 07
'1111 = 03

     $INCLUDE "rapidq.inc"
'------------------------------------------------modifie the path ...
     $RESOURCE aBoard AS "i:\rapidq\gg\magicNumber\appleBoard.bmp"
     $RESOURCE yes AS "i:\rapidq\gg\magicNumber\yes.bmp"
     $RESOURCE no AS "i:\rapidq\gg\magicNumber\no.bmp"
     $RESOURCE penR AS "i:\rapidq\gg\magicNumber\penR.bmp"
     $RESOURCE penL AS "i:\rapidq\gg\magicNumber\penL.bmp"
     $RESOURCE pinceng AS "i:\rapidq\gg\magicNumber\pinceng.bmp"
     $RESOURCE Quit AS "i:\rapidq\gg\magicNumber\quiteng.bmp"

     DIM c AS BYTE 'card
     DIM o AS BYTE 'yes
     DIM n AS BYTE 'no
     DIM c$ AS STRING
     c$ = ""
     DIM a$ AS STRING

     DECLARE SUB ok
     DECLARE SUB ohYes
     DECLARE SUB ohNo
     DECLARE SUB exitG
     DECLARE SUB reset
     DECLARE SUB number
     DECLARE SUB GV
     DECLARE SUB send
     Application.ShowHint = 1
     Application.HintColor = &hb5ff00

     DIM font AS QFONT
     DIM chfont AS QFONT
     DIM vfont AS QFONT
     font.Name = "Comic Sans Ms Gras"
     font.Size = 18
     chfont.Name = "Courier New"
     chfont.Size = 48
     vfont.Name = "Courier New"
     vfont.Size = 10


     CREATE Form AS QFORM
      CAPTION = "Magic number"
      Width = 640
      Height = 480
      BorderStyle = bsNone
      Center
      CREATE yesB AS QBUTTON
       Cursor = crHandPoint
       Left = 53
       Top = 420
       Height = 51
       Width = 50
       OnClick = ohYes
       BmpHandle = yes
       ShowHint = 1
       hint = "Yes"
      END CREATE
      CREATE noB AS QBUTTON
       Cursor = crHandPoint
       Left = 553
       Top = 416
       Height = 60
       Width = 39
       OnClick = ohNo
       BmpHandle = no
       ShowHint = 1
       hint = "No"
      END CREATE
'pens R & L
      CREATE bpenL AS QBUTTON
       Cursor = crHandPoint
       Left = 187
       Top = 442
       Height = 30
       Width = 64
       OnClick = GV
       BmpHandle = penL
       ShowHint = 1
       hint = "by Gérald VERDIER"
      END CREATE
      CREATE bpenR AS QBUTTON
       Cursor = crHandPoint
       Left = 375
       Top = 443
       Height = 30
       Width = 64
       OnClick = send
       BmpHandle = penR
       ShowHint = 1
       hint = "Bonus"
      END CREATE
      CREATE OkB AS QBUTTON
       Cursor = crHandPoint
       Left = 186
       Top = 30
       Height = 47
       Width = 251
       OnClick = ok
       BmpHandle = pinceng
       ShowHint = 1
       hint = "Click to begin"
      END CREATE
      CREATE QuitB AS QBUTTON
       Cursor = crHandPoint
       Left = 603
       Top = 2
       Height = 16
       Width = 26
       OnClick = exitG
       BmpHandle = Quit
       ShowHint = 1
       hint = "Exit"
      END CREATE
      CREATE image AS QIMAGE
       Left = 0
       Top = 0
       Width = 640
       Height = 480
       BmpHandle = aBoard
       OnClick = reset
      END CREATE
      CREATE resetL AS QLABEL
       top = 420
       left = 215
       font = vfont
       CAPTION = "Click on the picture to reset"
       transparent = 1
      END CREATE
     END CREATE
' Start
     reset
'-------------------
     SUB ok
      OkB.Visible = false
      noB.Visible = true
      yesB.Visible = true
      image.BmpHandle = aBoard
      c = c + 1
' card 1 ------ 4 - 2 - 3 - 7 - 1 - 8 - 6 - 5
      IF c=1 THEN
       image.Font = font
       image.TextOut (130,85,"Do you find your number here ?",&h00aa00,&h6600ff)
       image.Font = chfont
       image.TextOut (94,130," 4  *  2  * ",&h00aa00,&h6600ff)
       image.TextOut (94,196," *  3  *  7 ",&h00aa00,&h6600ff)
       image.TextOut (94,262," 1  *  8  * ",&h00aa00,&h6600ff)
       image.TextOut (94,326," *  6  *  5 ",&h00aa00,&h6600ff)
      END IF
' card 2 ------ 13 - 1 - 3 - 7 - 9 - 3 - 15 - 11
      IF c=2 AND o = 1 THEN
       image.Font = font
       image.TextOut (130,85,"Is your number on this page ?",&h00aa00,&h6600ff)
       image.Font = chfont
       image.TextOut (94,130,"    13 *  1 ",&h00aa00,&h6600ff)
       image.TextOut (94,196,"     * 5  7 ",&h00aa00,&h6600ff)
       image.TextOut (94,262," *  9     * ",&h00aa00,&h6600ff)
       image.TextOut (94,326," 3  15    11",&h00aa00,&h6600ff)
       c$=c$+STR$(o)
      END IF
      IF c=2 AND n = 1 THEN
       image.Font = font
       image.TextOut (130,85,"Trouvez-vous votre chiffre ici ?",&haaaa11,&h660066)
       image.Font = chfont
       image.TextOut (94,130,"    13 *  1 ",&h00aa00,&h7000ff)
       image.TextOut (94,196,"     * 5  7 ",&h00aa00,&h6600ff)
       image.TextOut (94,262," *  9     * ",&h00aa00,&h7000ff)
       image.TextOut (94,326," 3  15    11",&h00aa00,&h7000ff)
       c$=c$+STR$(n-1)
      END IF
' card 3 ------ 4 - 11 - 3 - 7 - 16 - 8 - 15 - 12
      IF c=3 AND o = 1 THEN
       image.Font = font
       image.TextOut (130,85,"Do you see your number again ?",&h00aa00,&h6600ff)
       image.Font = chfont
       image.TextOut (94,130," *  4  11 * ",&h00aa00,&h7000ff)
       image.TextOut (94,196," *     3  7 ",&h00aa00,&h7000ff)
       image.TextOut (94,262," 16 8  *  15",&h00aa00,&h7000ff)
       image.TextOut (94,326," *  12      ",&h00aa00,&h7000ff)
       c$=c$+STR$(o)
      END IF
      IF c=3 AND n = 1 THEN
       image.Font = font
       image.TextOut (130,85,"Is your number visible ?",&haaaa11,&h660066)
       image.Font = chfont
       image.TextOut (94,130," *  4  11 * ",&h00aa00,&h7000ff)
       image.TextOut (94,196," *     3  7 ",&h00aa00,&h7000ff)
       image.TextOut (94,262," 16 8  *  15",&h00aa00,&h7000ff)
       image.TextOut (94,326," *  12      ",&h00aa00,&h7000ff)
       c$=c$+STR$(n-1)
      END IF
' card 4 ------ 10 - 3 - 1 - 12 - 9 - 11 - 2 - 4
      IF c=4 AND o = 1 THEN
       image.Font = font
       image.TextOut (130,85,"Number ... or no number ?",&h00aa00,&h6600ff)
       image.Font = chfont
       image.TextOut (94,130,"      10    ",&h00aa00,&h7000ff)
       image.TextOut (94,196,"       *  3 ",&h00aa00,&h7000ff)
       image.TextOut (94,262," 1  *  12 * ",&h00aa00,&h7000ff)
       image.TextOut (94,326," 9  11 2  4 ",&h00aa00,&h7000ff)
       c$=c$+STR$(o)
      END IF
      IF c=4 AND n = 1 THEN
       image.Font = font
       image.TextOut (130,85,"is there your number somewhere ?",&haaaa11,&h660066)
       image.Font = chfont
       image.TextOut (94,130,"      10    ",&h00aa00,&h7000ff)
       image.TextOut (94,196,"       *  3 ",&h00aa00,&h7000ff)
       image.TextOut (94,262," 1  *  12 * ",&h00aa00,&h7000ff)
       image.TextOut (94,326," 9  11 2  4 ",&h00aa00,&h7000ff)
       c$=c$+STR$(n-1)
      END IF
'result
      IF c=5 AND o = 1 THEN
       c$=c$+STR$(o)
       image.Font = font
       number
       image.TextOut (94,130,"Your number is " + a$+" ",&h00aa00,&h7000ff)
      END IF
      IF c=5 AND n = 1 THEN
       c$=c$+STR$(n-1)
       image.Font = font
       number
       image.TextOut (94,130,"Your number is " + a$+" ",&h00aa00,&h7000ff)
      END IF
                'image.Font = vfont
        'image.TextOut (200,450," c = "+str$(c)+" o = "+str$(o)+" n = "+str$(n)+"c$ = "+c$,&h00bb00,&hffffff)

     END SUB
'-------------------
     SUB ohYes
      n = 0
      o = 1
'c = c + 1
      Ok
     END SUB

     SUB ohNo
      o = 0
      n = 1
'c = c + 1
      Ok
     END SUB
'-------------------
     SUB exitG
      Form.CLOSE
     END SUB
'-------------------
     SUB reset ' card 0 between 1 et 16
      o = 0
      n = 0
      c = 0
      c$ = ""
      image.BmpHandle = aBoard
      OkB.Visible = true
      noB.Visible = false
      yesB.Visible = false
      image.Font = font
      image.TextOut (60,90,"Please, choose a number ...       Ok to start",&hff00ff,0)
      image.Font = chfont
      image.TextOut (94,130," 9  11 2  1 ",&h00aa00,&h6600ff)
      image.TextOut (94,196," 10 12 4  3 ",&h00aa00,&h6600ff)
      image.TextOut (94,262," 6  5 13 15 ",&h00aa00,&h6600ff)
      image.TextOut (94,326," 8  7 14 16 ",&h00aa00,&h6600ff)
                        'image.Font = vfont
        'image.TextOut (200,450," c = "+str$(c)+" o = "+str$(o)+" n = "+str$(n),&h00bb00,&hffffff)

     END SUB
'-------------------
     SUB number 'choice of c$
      SELECT CASE c$
      CASE "0000"
       a$ = "14"
      CASE "0001"
       a$ = "10"
      CASE "0010"
       a$ = "16"
      CASE "0011"
       a$ = "12"
      CASE "0100"
       a$ = "13"
      CASE "0101"
       a$ = "9"
      CASE "0110"
       a$ = "15"
      CASE "0111"
       a$ = "11"
      CASE "1000"
       a$ = "6"
      CASE "1001"
       a$ = "2"
      CASE "1010"
       a$ = "8"
      CASE "1011"
       a$ = "4"
      CASE "1100"
       a$ = "5"
      CASE "1101"
       a$ = "1"
      CASE "1110"
       a$ = "7"
      CASE "1111"
       a$ = "3"
      END SELECT
     END SUB

     SUB GV
      SHOWMESSAGE "Concept by Gérald VERDIER"
     END SUB

     SUB send
      SHOWMESSAGE "To receive an exemple of this mathematical game by mail : gerald.verdier@club-internet.fr"
     END SUB


     Form.SHOWMODAL
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-11-22 05:54:11