8 de mayo de 2021

Lecciones de malabarismo

Con tanto tiempo en casa, tengo que mantenerme ocupado.

Esto es totalmente inútil a menos que quieras aprender a hacer malabares.

Cuando estaba en la escuela, aprendí a hacer malabares, un pariente me enseñó. Aquí están las 3 lecciones para practicar.

Tony Vignone
FL, USA

PUBLIC oForm
oForm = CREATEOBJECT('form1')
oForm.SHOW(1)
DEFINE CLASS form1 AS FORM
  HEIGHT = 369
  WIDTH = 461
  DOCREATE = .T.
  AUTOCENTER = .T.
  CAPTION = "Lecciones de malabarismo"
  ad = 0
  NAME = "form1"

  ADD OBJECT b1 AS SHAPE WITH ;
    TOP = 252, ;
    LEFT = 36, ;
    HEIGHT = 24, ;
    WIDTH = 24, ;
    CURVATURE = 99, ;
    BACKCOLOR = RGB(0,128,255), ;
    NAME = "b1"

  ADD OBJECT b2 AS SHAPE WITH ;
    TOP = 252, ;
    LEFT = 372, ;
    HEIGHT = 24, ;
    WIDTH = 24, ;
    CURVATURE = 99, ;
    BACKCOLOR = RGB(255,0,0), ;
    NAME = "b2"

  ADD OBJECT b3 AS SHAPE WITH ;
    TOP = 252, ;
    LEFT = 408, ;
    HEIGHT = 24, ;
    WIDTH = 24, ;
    CURVATURE = 99, ;
    BACKCOLOR = RGB(128,255,128), ;
    NAME = "b3"

  ADD OBJECT Line1 AS LINE WITH ;
    BORDERWIDTH = 3, ;
    HEIGHT = 0, ;
    LEFT = 12, ;
    TOP = 276, ;
    WIDTH = 444, ;
    NAME = "Line1"

  ADD OBJECT Command1 AS COMMANDBUTTON WITH ;
    TOP = 318, ;
    LEFT = 108, ;
    HEIGHT = 25, ;
    WIDTH = 60, ;
    FONTSIZE = 9, ;
    CAPTION = "Malabar 1", ;
    TABSTOP = .F., ;
    BACKCOLOR = RGB(255,179,179), ;
    NAME = "Command1"

  ADD OBJECT Command2 AS COMMANDBUTTON WITH ;
    TOP = 318, ;
    LEFT = 192, ;
    HEIGHT = 25, ;
    WIDTH = 60, ;
    CAPTION = "Malabar 2", ;
    TABSTOP = .F., ;
    BACKCOLOR = RGB(255,179,179), ;
    NAME = "Command2"

  ADD OBJECT Command3 AS COMMANDBUTTON WITH ;
    TOP = 318, ;
    LEFT = 276, ;
    HEIGHT = 25, ;
    WIDTH = 60, ;
    CAPTION = "Malabar 3", ;
    TABSTOP = .F., ;
    BACKCOLOR = RGB(255,179,179), ;
    NAME = "Command3"

  ADD OBJECT Spinner1 AS SPINNER WITH ;
    ALIGNMENT = 2, ;
    HEIGHT = 25, ;
    KEYBOARDHIGHVALUE = 6, ;
    KEYBOARDLOWVALUE = 0, ;
    LEFT = 420, ;
    SPINNERHIGHVALUE =   6.00, ;
    SPINNERLOWVALUE =   0.00, ;
    TABSTOP = .F., ;
    TOP = 318, ;
    WIDTH = 37, ;
    CONTROLSOURCE = "Thisform.ad", ;
    NAME = "Spinner1"

  ADD OBJECT Label2 AS LABEL WITH ;
    FONTNAME = "Tahoma", ;
    FONTSIZE = 8, ;
    ALIGNMENT = 2, ;
    CAPTION = "Para con X, FIN, Barra Espaciadora", ;
    HEIGHT = 13, ;
    LEFT = 154, ;
    TOP = 348, ;
    WIDTH = 169, ;
    NAME = "Label2"

  ADD OBJECT Label1 AS LABEL WITH ;
    FONTNAME = "Tahoma", ;
    FONTSIZE = 8, ;
    WORDWRAP = .T., ;
    ALIGNMENT = 2, ;
    CAPTION = "Ajustar tiro", ;
    HEIGHT = 31, ;
    LEFT = 372, ;
    TOP = 318, ;
    WIDTH = 40, ;
    NAME = "Label1"

  ADD OBJECT Label3 AS LABEL WITH ;
    FONTSIZE = 8, ;
    WORDWRAP = .T., ;
    ALIGNMENT = 2, ;
    BACKSTYLE = 0, ;
    CAPTION = "Practica en este orden", ;
    HEIGHT = 48, ;
    LEFT = 36, ;
    TOP = 309, ;
    WIDTH = 48, ;
    NAME = "Label3"

  ADD OBJECT Label4 AS LABEL WITH ;
    FONTNAME = "Wingdings 3", ;
    FONTSIZE = 14, ;
    CAPTION = "u", ;
    HEIGHT = 25, ;
    LEFT = 84, ;
    TOP = 321, ;
    WIDTH = 18, ;
    NAME = "Label4"

  ADD OBJECT LblMsg AS LABEL WITH ;
    FONTSIZE = 8, ;
    ALIGNMENT = 2, ;
    BACKSTYLE = 0, ;
    CAPTION = "No mires tus manos. Mira hacia adelante.", ;
    HEIGHT = 16, ;
    LEFT = 96, ;
    TOP = 301, ;
    WIDTH = 252, ;
    NAME = "lblMsg"

  ADD OBJECT Image1 AS IMAGE WITH ;
    HEIGHT = 25, ;
    LEFT = 24, ;
    TOP = 278, ;
    WIDTH = 61, ;
    NAME = "Image1"

  ADD OBJECT Image2 AS IMAGE WITH ;
    HEIGHT = 25, ;
    LEFT = 382, ;
    TOP = 278, ;
    WIDTH = 61, ;
    NAME = "Image2"

  PROCEDURE INIT
    DECLARE Sleep IN kernel32 INTEGER dwMilliseconds
    WITH THISFORM

      PUBLIC nspeed
      nspeed = 100
      PUBLIC x1,x2,x3,y1,y2,y3
      PUBLIC esclist
      PUBLIC i1,i2,i3
      PUBLIC w,b1p,b2p,b3p
      PUBLIC side1,side2,side3,msg1,msg2
      w = 30  &&30*12
      esclist = "6,120,32"
      side1 = "L"
      side2 = "R"
      side3 = "R"
      msg1 = "No mires tus manos. Mira hacia adelante."
      msg2 = "Tira debajo de uno entrante para que no choquen"
      SET CURSOR OFF
      .image1.PICTUREVAL = .handpicL()
      .image2.PICTUREVAL = .handpicR()
    ENDWITH
  ENDPROC

  PROCEDURE DESTROY
    SET CURSOR ON
  ENDPROC

  PROCEDURE Command1.CLICK
    WITH THISFORM
      nspeed = 70
      IF .b1.TOP < 252
        .RESET()
        sleep(1000)
      ELSE
        .RESET()
      ENDIF

      LOCAL i
      x1 = .ad
      FOR i=1 TO 30*8
        .throw1()
        IF INLIST(INKEY(),&esclist) THEN  && END
          .RESET()
          EXIT
        ENDIF
      NEXT
    ENDWITH
  ENDPROC

  PROCEDURE Command2.CLICK
    WITH THISFORM
      nspeed = 50
      IF .b1.TOP < 252
        .RESET()
        sleep(1000)
      ELSE
        .RESET()
      ENDIF

      .lblMsg.CAPTION = msg2
      LOCAL i
      x1 = 0
      b1p = 0
      DO WHILE b1p = 0
        .throw1(0.6)
      ENDDO
      x2 = w-.ad
      FOR i=1 TO 30*8
        .throw2()
        .throw1()
        IF INLIST(INKEY(),&esclist) THEN  && END
          .RESET()
          EXIT
        ENDIF
      NEXT
    ENDWITH
  ENDPROC

  PROCEDURE Command3.CLICK
    WITH THISFORM
      nspeed = 25
      IF .b1.TOP < 252
        .RESET()
        sleep(1000)
      ELSE
        .RESET()
      ENDIF

      .lblMsg.CAPTION = msg2
      LOCAL i
      x1 = 0
      b1p = 0
      DO WHILE b1p = 0
        .throw1(.2)
      ENDDO
      x2 = w
      b1p = 0
      DO WHILE b1p = 0
        .throw2()
        .throw1(.6)
      ENDDO
      x3 = w-.ad
      FOR i=1 TO 30*12
        .throw3()
        .throw2()
        .throw1()
        IF INLIST(INKEY(),&esclist) THEN  && END
          .RESET()
          EXIT
        ENDIF
      NEXT
    ENDWITH
  ENDPROC

  PROCEDURE throw1
    LPARAMETER npart
    npart = EVL(npart,0.2)
    WITH THISFORM
      y1 = MAX(0,(x1-.ad)*(w-x1))
      .b1.LEFT = 36+12*x1
      .b1.TOP = 252-y1
      sleep(nspeed)
      IF x1 = INT(npart*w) THEN
        b1p = 1
      ENDIF
      IF side1 = "L" THEN
        x1 = x1+1
        IF x1 = w THEN
          side1 = "R"
        ENDIF
      ELSE
        x1 = x1-1
        IF x1 = .ad THEN
          side1 = "L"
        ENDIF
      ENDIF
    ENDWITH
  ENDPROC

  PROCEDURE throw2
    WITH THISFORM
      y2 = MAX(0,x2*(w-.ad-x2))
      .b2.LEFT = 36+12*x2
      .b2.TOP = 252-y2
      sleep(nspeed)
      IF x2 = INT(.8*w) THEN
        b2p = 1
      ENDIF
      IF side2 = "L" THEN
        x2 = x2+1
        IF x2 = w-.ad THEN
          side2 = "R"
        ENDIF
      ELSE
        x2 = x2-1
        IF x2 = 0 THEN
          side2 = "L"
        ENDIF
      ENDIF
    ENDWITH
  ENDPROC

  PROCEDURE throw3
    WITH THISFORM
      y3 = MAX(0,x3*(w-.ad-x3))
      .b3.LEFT = 36+12*x3
      .b3.TOP = 252-y3
      sleep(nspeed)
      IF side3 = "L" THEN
        x3 = x3+1
        IF x3 = w-.ad THEN
          side3 = "R"
        ENDIF
      ELSE
        x3 = x3-1
        IF x3 = 0 THEN
          side3 = "L"
        ENDIF
      ENDIF
    ENDWITH
  ENDPROC

  PROCEDURE RESET
    WITH THISFORM
      .b1.LEFT = 26
      .b2.LEFT = 372
      .b3.LEFT = 408
      STORE 252 TO .b1.TOP,.b2.TOP,.b3.TOP
      side1 = "L"
      side2 = "R"
      side3 = "R"
      .lblMsg.CAPTION = msg1
    ENDWITH
  ENDPROC

  PROCEDURE handpicL
    LOCAL un
    *     1...5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80....5...90....5..100'
    un =    'FFD8FFE000104A46494600010101012C012C0000FFE1009245786966000049492A000800000002000E010200590000002600'
    un = m.un+'000098820200090000008000000000000000566563746F7220696C6C757374726174696F6E206F6620612070616C6D207570'
    un = m.un+'206F75747265616368696E672068616E6420676573747572652C2069736F6C61746564206F6E207768697465206261636B67'
    un = m.un+'726F756E642E0000626C61636B7265640000FFDB0043000A07070807060A0808080B0A0A0B0E18100E0D0D0E1D1516111823'
    un = m.un+'1F2524221F2221262B372F26293429212230413134393B3E3E3E252E4449433C48373D3E3BFFDB0043010A0B0B0E0D0E1C10'
    un = m.un+'101C3B2822283B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B'
    un = m.un+'3B3B3B3B3B3BFFC00011080016003303012200021101031101FFC4001F000001050101010101010000000000000000010203'
    un = m.un+'0405060708090A0BFFC400B5100002010303020403050504040000017D010203000411051221314106135161072271143281'
    un = m.un+'91A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758'
    un = m.un+'595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7'
    un = m.un+'B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101'
    un = m.un+'010101010101010000000000000102030405060708090A0BFFC400B511000201020404030407050404000102770001020311'
    un = m.un+'04052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A353637'
    un = m.un+'38393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A929394959697'
    un = m.un+'98999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3'
    un = m.un+'F4F5F6F7F8F9FAFFDA000C03010002110311003F00F63620726B32E35491837D9235655FF968E4E0FD00EB59C902A01E6C6A'
    un = m.un+'7E6E371CFE95688F9368C01818F415C92AEDAD343A634527A9565D66770639E7F2D8F4585305BD81C935368B61702F5AF648'
    un = m.un+'7ECE850AED6FBD2127AB7FF5F9AA92DAEC6DCF18652796001AB114925B465ADEEA555FEEB8DC31F422A233D6F3349434B40E'
    un = m.un+'887D296B9F6D52F72163916427D23E9FF8F556FB7EA1792BDB4734924A07DD83680BFEF3F6AE9F6CBA1CFEC5EED9D4F14561'
    un = m.un+'C3A46ADE52EED6E543DD5630C07E2DC9FC68AD2E4D97728CD6BA9B49E53B5B1FF8137F854C965A8C49BCB5BE3D0337F85145'
    un = m.un+'70F2A3AEECAD26A72C0712C487D76B1A92D2E66D4D8C76E91A05EA64E7F414515296A53DAE599344BA9CED9B50DB1F758A32'
    un = m.un+'33ED9CD6CD9D9C1636EB05BC61117D3BFB9F7A28AEBA492392726F727A28A2B5323FFFD9'

    RETURN STRCONV(un,16)
  ENDPROC

  PROCEDURE handpicR
    LOCAL un
    *     1...5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80....5...90....5..100'
    un =    'FFD8FFE000104A46494600010101012C012C0000FFE1009245786966000049492A000800000002000E010200590000002600'
    un = m.un+'000098820200090000008000000000000000566563746F7220696C6C757374726174696F6E206F6620612070616C6D207570'
    un = m.un+'206F75747265616368696E672068616E6420676573747572652C2069736F6C61746564206F6E207768697465206261636B67'
    un = m.un+'726F756E642E0073626C61636B72656400FFFFDB0043000A07070807060A0808080B0A0A0B0E18100E0D0D0E1D1516111823'
    un = m.un+'1F2524221F2221262B372F26293429212230413134393B3E3E3E252E4449433C48373D3E3BFFDB0043010A0B0B0E0D0E1C10'
    un = m.un+'101C3B2822283B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B3B'
    un = m.un+'3B3B3B3B3B3BFFC00011080016003303012200021101031101FFC4001F000001050101010101010000000000000000010203'
    un = m.un+'0405060708090A0BFFC400B5100002010303020403050504040000017D010203000411051221314106135161072271143281'
    un = m.un+'91A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758'
    un = m.un+'595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7'
    un = m.un+'B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101'
    un = m.un+'010101010101010000000000000102030405060708090A0BFFC400B511000201020404030407050404000102770001020311'
    un = m.un+'04052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A353637'
    un = m.un+'38393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A929394959697'
    un = m.un+'98999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3'
    un = m.un+'F4F5F6F7F8F9FAFFDA000C03010002110311003F00F66A2B99B84D5749324D35E5C4B175F3906E03FDE43D3EA38A747ABEA0'
    un = m.un+'515CC91BAB747550C3F422B275527666DEC9B574CD7D5ED25BED364821601DB070C786C1CE0FB1AC186F26D33F76E25B361F'
    un = m.un+'76265CA37D074FC8D5B37D753E50DE155C7263400FE7CD537815A4DA8AF2B9FBC5F93F99AC2A544DDE3B9B53834AD2D8D0B6'
    un = m.un+'D5EF9CEE78A1914765CA1FE6456B5B5D457516F8C9F4653D54FA115896F118536923E83B524D1C6D20CA2973DFA1E9EB442B'
    un = m.un+'496FA8A74A2F63A2A2B94366E4E4A7FE3D455FD63C89F61E6755D6B1AE7C3ABF6933D85C1B466E5902E509FA64628A2B7945'
    un = m.un+'495998464E2F420B9B4BEB084CEF24132AF5F94AB7F5ACF8F5A131C470F3DF71C514571D48A8CAC8EDA6F9A3765D861D42F9'
    un = m.un+'498FC841EEE7FC2A096C75281B7E6DB3D321DBFC28A29F246D71733BD8B51E9DAC4881C4D6A011D32DFE1451455AA71239E4'
    un = m.un+'7FFFD9'

    RETURN STRCONV(un,16)
  ENDPROC

ENDDEFINE

Publicado en el foro de Foxite por Tony Vignone: FOR FUN ONLY

1 comentario :

Los comentarios son moderados, por lo que pueden demorar varias horas para su publicación.