You are on page 1of 8

Formulario Palabra

CÓDIGO
Botón Jugar
Evento_clic
PUBLIC a,s,err,x,hint
a=0
s=0
err = 0

If NOT EMPTY(ALLTRIM(thisform.TextBox1.value)) And NOT


EMPTY(ALLTRIM(thisform.txtword.value)) And LEN(ALLTRIM(thisform.txtword.value))
<= 15 Then
If thisform.TextBox1.value = "Proporciona una ayuda" Then
MESSAGEBOX("Proporcione una ayuda al otro jugador")
thisform.TextBox1.SetFocus
Else
For a = 1 To LEN(ALLTRIM(thisform.txtword.value))
s = ASC(subst(ALLTRIM(thisform.txtword.value),a,1))
If s <= 64 Or s >= 91 Then
err = err + 1
EndIf
endfor
If err > 0 Then
MESSAGEBOX("Solamente letras son aceptables en este cuadro ..... por favor
vuelva a verificar su palabra",48)
thisform.txtword.SetFocus

ELSE
If err = 0 Then
If ALLTRIM(thisform.TextBox1.value) <> ALLTRIM(thisform.txtword.value)
Then
x = ALLTRIM(thisform.txtword.value)
hint = ALLTRIM(thisform.TextBox1.value)
thisform.txtword.Value = " "
thisform.TextBox1.value = " "
DO FORM ahorcado
thisform.Release
ELSE
MESSAGEBOX("La sugerencia no puede ser la misma que la palabra
dada")
EndIf
ENDIF
ENDIF
endif
ELSE
MESSAGEBOX("Error",48)
EndIf

Ejecución
Formulario Ahorcado

Código
INIT

PUBLIC word, wordlength,s,chance,cadmostrar

cadmostrar= " "

s=0

chance = 8

THISFORM.label2.Caption = hint

THISFORM.label4.Value = chance

word =x

wordlength = LEN(x)

For s = 1 To wordlength
cadmostrar = cadmostrar+"-"

ENDFOR

thisform.TextBox1.value = cadmostrar

BOTONES A-Z
i=0

lettercount = 0

thisform.TextBox2.Value = thisform.TextBox2.Value + "A"

For i = 1 To LEN(word)

If subst(word, i, 1) = thisform.A.caption Then

lettercount = lettercount + 1

cadmostrar = stuff(cadmostrar,i,1,thisform.A.caption)

EndIf

ENDFOR

thisform.textBox1.Value = cadmostrar

If lettercount < 1 Then

MESSAGEBOX("La letra no esta en esta palabra")

chance = chance - 1

If chance = 0 Then

MESSAGEBOX("Fin del Juego"+CHR(13)+"La palabra era: "+ word,48)

thisform.A.Enabled = .f.

thisform.B.Enabled = .f.

thisform.C.Enabled = .f.

thisform.D.Enabled = .f.

thisform.E.Enabled = .f.

thisform.F.Enabled = .f.

thisform.G.Enabled = .f.

thisform.H.Enabled = .f.

thisform.I.Enabled = .f.
thisform.J.Enabled = .f.

thisform.K.Enabled = .f.

thisform.L.Enabled = .f.

thisform.M.Enabled = .f.

thisform.N.Enabled = .f.

thisform.O.Enabled = .f.

thisform.P.Enabled = .f.

thisform.Q.Enabled = .f.

thisform.R.Enabled = .f.

thisform.S.Enabled = .f.

thisform.T.Enabled = .f.

thisform.U.Enabled = .f.

thisform.V.Enabled = .f.

thisform.W.Enabled = .f.

thisform.X.Enabled = .f.

thisform.Y.Enabled = .f.

thisform.Z.Enabled = .f.

* GroupBox1.Enabled = False

EndIf

EndIf

thisform.A.Enabled = .f.

thisform.Label4.Value = chance

thisform.Label4.valid()

If thisform.TextBox1.value = word Then

MESSAGEBOX("Felicitaciones. . ." + "Lo has logrado",64)

EndIf
Proyecto: Ahorcado

INTEGRANTES:
YULISSA RAMIREZ DEL ROSARIO
ERICKA TOMALA PEREZ

CURSO: 2 INFORMATICA A

You might also like