HOLA!!!
Bueno, el reto es simple, desofusquen mi codigo y diganme donde hago trampa >:D
Private Sub Form_Load()
Dim Oponente As String
Dim Res As String
Empezar:
Oponente = InputBox("1)Piedra" & vbNewLine & "2)Papel" & vbNewLine & "3)Tijera", "Elija una opción"): If VerifClean(VerifClean(Oponente = "1", Oponente = "2"), Oponente = "3") Then GoTo Continuar Else GoTo Empezar
Continuar:
Oponente = Trim(Str(Factorial(CLng(Int(Val(Oponente))))))
If Not Rnd() Then
If InStr(Oponente, StrReverse(Oponente)) > 0 Then If VerifClean(VerifClean(Oponente = "6", Oponente = "1"), Oponente = "2") Then If CLng(Int(Val(Oponente))) = 6 Then Oponente = "Usted Eligio Tijera" Else If CLng(Int(Val(Oponente))) = 2 Then Oponente = "Usted Eligio Papel" Else If CLng(Int(Val(Oponente))) = 1 Then Oponente = "Usted Eligio Piedra"
If InStr(Factorial(2 ^ 2) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(6) / 72) * 10 + (Factorial(3) - Factorial(1))) & Chr((Factorial(6) / 72) * 10 + 2 * Factorial(2) - 2 * (Factorial(6) / 72)))) Then a = True: b = False
If InStr(Factorial(2 ^ 2) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(6) / 72) * 10 - (Factorial(2) + Factorial(1))) & Chr((Factorial(6) / 72) * 10 - 2 * (Factorial(6) / 72)))) Then a = False: b = True
If InStr(Factorial(2 ^ 2) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(6) / 72) * 10 + (Factorial(3) - Factorial(1))) & Chr((Factorial(6) / 72) * 10 - 2 * (Factorial(6) / 72)))) Then a = True: b = True
If VerifClean(CLng(Int(Val(Rnd()))), CBool(a)) Then If VerifClean(CLng(Int(Val(Rnd()))), CBool(b)) Then Res = "Pedro Eligio Papel" Else Res = "Pedro Eligio Piedra" Else Res = "Pedro Eligio Tijera"
If Mid(Res, 14, Len(Res) - 13) = Mid(Oponente, 14, Len(Oponente) - 13) Then
respuesta = "Hubo Empate"
Else
If Mid(Res, 14, Len(Res) - 13) = "Tijera" And Mid(Oponente, 14, Len(Oponente) - 13) = "Papel" Then respuesta = "Ha Ganado Pedro"
If Mid(Res, 14, Len(Res) - 13) = "Papel" And Mid(Oponente, 14, Len(Oponente) - 13) = "Tijera" Then respuesta = "Ha Ganado Usted"
If Mid(Res, 14, Len(Res) - 13) = "Tijera" And Mid(Oponente, 14, Len(Oponente) - 13) = "Piedra" Then respuesta = "Ha Ganado Usted"
If Mid(Res, 14, Len(Res) - 13) = "Papel" And Mid(Oponente, 14, Len(Oponente) - 13) = "Piedra" Then respuesta = "Ha Ganado Pedro"
If Mid(Res, 14, Len(Res) - 13) = "Piedra" And Mid(Oponente, 14, Len(Oponente) - 13) = "Tijera" Then respuesta = "Ha Ganado Pedro"
If Mid(Res, 14, Len(Res) - 13) = "Piedra" And Mid(Oponente, 14, Len(Oponente) - 13) = "Papel" Then respuesta = "Ha Ganado Usted"
End If
Else
If InStr(Oponente, StrReverse(Oponente)) > 1 Then If VerifClean(VerifClean(Oponente = "3", Oponente = "1"), Oponente = "8") Then If CLng(Int(Val(Oponente))) = 8 Then Oponente = "Usted Eligio Tijera" Else If CLng(Int(Val(Oponente))) = 3 Then Oponente = "Usted Eligio Papel" Else If CLng(Int(Val(Oponente))) = 1 Then Oponente = "Usted Eligio Piedra"
If InStr(Factorial(2 ^ 3) - Factorial(5) - Factorial(2) * 1, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(5) / 69) * 10 - (Factorial(3) - Factorial(2))) & Chr((Factorial(5) / 69) * 10 - 2 * Factorial(3) - 3 * (Factorial(5) / 69)))) Then a = True: b = False
If InStr(Factorial(2 ^ 3) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(5) / 69) * 10 + (Factorial(2) + Factorial(2))) & Chr((Factorial(5) / 69) * 10 + 2 * (Factorial(5) / 69)))) Then a = False: b = True
If InStr(Factorial(2 ^ 3) - Factorial(6) - Factorial(3) * 2, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(5) / 69) * 10 - (Factorial(3) - Factorial(2))) & Chr((Factorial(5) / 69) * 10 + 2 * (Factorial(5) / 69)))) Then a = True: b = True
If VerifClean(CLng(Int(Val(Rnd()))), CBool(a)) Then If VerifClean(CLng(Int(Val(Rnd()))), CBool(b)) Then Res = "Pedro Eligio Papel" Else Res = "Pedro Eligio Piedra" Else Res = "Pedro Eligio Tijera"
If Mid(Res, 14, Len(Res) - 13) = Mid(Oponente, 14, Len(Oponente) - 13) Then
respuesta = "Hubo Empate"
Else
If Mid(Res, 14, Len(Res) - 13) = "Tijera" And Mid(Oponente, 14, Len(Oponente) - 13) = "Papel" Then respuesta = "Ha Ganado Pedro"
If Mid(Res, 14, Len(Res) - 13) = "Papel" And Mid(Oponente, 14, Len(Oponente) - 13) = "Tijera" Then respuesta = "Ha Ganado Usted"
If Mid(Res, 14, Len(Res) - 13) = "Tijera" And Mid(Oponente, 14, Len(Oponente) - 13) = "Piedra" Then respuesta = "Ha Ganado Usted"
If Mid(Res, 14, Len(Res) - 13) = "Papel" And Mid(Oponente, 14, Len(Oponente) - 13) = "Piedra" Then respuesta = "Ha Ganado Pedro"
If Mid(Res, 14, Len(Res) - 13) = "Piedra" And Mid(Oponente, 14, Len(Oponente) - 13) = "Tijera" Then respuesta = "Ha Ganado Pedro"
If Mid(Res, 14, Len(Res) - 13) = "Piedra" And Mid(Oponente, 14, Len(Oponente) - 13) = "Papel" Then respuesta = "Ha Ganado Usted"
End If
End If
MsgBox Oponente & vbNewLine & Res & vbNewLine & respuesta, , "Resultado"
End
End Sub
Private Function Factorial(n As Long) As Long
Dim x As Long
Factorial = 1
For x = 1 To n
Factorial = Factorial * x
Next
If n = 0 Then Factorial = 0
End Function
Private Function VerifClean(Clean1 As Long, Clean2 As Long) As Long
Dim Cle1() As Boolean: Dim Cle2() As Boolean: Dim Cle3() As Boolean: Dim CT As Long: Dim Tam As Long: Dim b1 As Long: Dim b2 As Long: b1 = Clean1: b2 = Clean2
Do
ReDim Preserve Cle1(CT)
If b1 = 1 Then ReDim Preserve Cle1(CT): Cle1(CT) = True: Exit Do
If b1 = 0 Then ReDim Preserve Cle1(CT): Exit Do
Cle1(CT) = CBool(b1 Mod 2): b1 = Fix(b1 / 2): CT = CT + 1
Loop
CT = 0
Do
If b2 = 1 Then ReDim Preserve Cle2(CT): Cle2(CT) = True: Exit Do
If b2 = 0 Then ReDim Preserve Cle2(CT): Exit Do
ReDim Preserve Cle2(CT): Cle2(CT) = CBool(b2 Mod 2): b2 = Fix(b2 / 2): CT = CT + 1
Loop
If UBound(Cle1) > UBound(Cle2) Then ReDim Preserve Cle2(UBound(Cle1))
If UBound(Cle1) < UBound(Cle2) Then ReDim Preserve Cle1(UBound(Cle2))
Tam = UBound(Cle1): ReDim Cle3(Tam)
For x = 0 To Tam
If Cle1(x) Then If Cle2(x) = False Then Cle3(x) = True
If Cle2(x) Then If Cle1(x) = False Then Cle3(x) = True
Next
For x = 0 To Tam
If Cle3(x) Then VerifClean = VerifClean + 2 ^ (x)
Next
End Function
GRACIAS POR LEER!!!
JAJA , esta difisil la cosa
Yo lo desofusque, no es muy complicado pero despues me dio pachorra analizar el codigo xD
Saludos
HOLA!!!
No tienes permitido ver enlaces.
Registrate o Entra a tu cuenta
Yo lo desofusque, no es muy complicado pero despues me dio pachorra analizar el codigo xD
Saludos
tomate un yogurisimo energia vital y vence a pachorra
P.D: no creo que lo hayas desofuscado, este codigo tiene distintos tipos de ofuscacion no solo el uso de :
GRACIAS POR LEER!!!
No tienes permitido ver enlaces.
Registrate o Entra a tu cuenta
HOLA!!!
No tienes permitido ver enlaces.
Registrate o Entra a tu cuenta
Yo lo desofusque, no es muy complicado pero despues me dio pachorra analizar el codigo xD
Saludos
tomate un yogurisimo energia vital y vence a pachorra
P.D: no creo que lo hayas desofuscado, este codigo tiene distintos tipos de ofuscacion no solo el uso de :
GRACIAS POR LEER!!!
es evidente viendo dobles strreverse entre otras cosas que tiene más que el uso de : xDD
le voy a hechar una miradita a ver que logro hacer
saludos!
Interesante, lo guardo para hacer en otro momento.
al final se me re pasó, me puse a hacer otras cosas y no terminé.
cuando tenga un rato al pedo lo intento.
saludos!
uhm hace mucho no tocaba vb, me costó bastante...
ya te mandé la solución por mp
saludos!
HOLA!!!
Felicitaciones, tenemos un GANADOR!
@[H]arkonnen: Publica la respuesta
GRACIAS POR LEER!!!
No tienes permitido ver enlaces.
Registrate o Entra a tu cuenta
HOLA!!!
Felicitaciones, tenemos un GANADOR!
@[H]arkonnen: Publica la respuesta
GRACIAS POR LEER!!!
el truco está acá
If InStr(Factorial(2 ^ 2) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(6) / 72) * 10 + (Factorial(3) - Factorial(1))) & Chr((Factorial(6) / 72) * 10 + 2 * Factorial(2) - 2 * (Factorial(6) / 72)))) Then a = True: b = False
If InStr(Factorial(2 ^ 2) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(6) / 72) * 10 - (Factorial(2) + Factorial(1))) & Chr((Factorial(6) / 72) * 10 - 2 * (Factorial(6) / 72)))) Then a = False: b = True
If InStr(Factorial(2 ^ 2) - Factorial(3) - Factorial(1) * 4, StrReverse((StrReverse(Oponente))), StrReverse(Chr((Factorial(6) / 72) * 10 + (Factorial(3) - Factorial(1))) & Chr((Factorial(6) / 72) * 10 - 2 * (Factorial(6) / 72)))) Then a = True: b = True
que es lo mismo que esto:
If InStr(14, Oponente, "ti") Then a = True: b = False
If InStr(14, Oponente, "Pi") Then a = False: b = True
If InStr(14, Oponente, "Pa") Then a = True: b = True
armas las variables para que los dos if con las funciónes xor de esta linea:
If VerifClean(CLng(Int(Val(Rnd()))), CBool(a)) Then If VerifClean(CLng(Int(Val(Rnd()))), CBool(b)) Then Res = "Pedro Eligio Papel" Else Res = "Pedro Eligio Piedra" Else Res = "Pedro Eligio Tijera"
seleccionen siempre la correcta, porque lo armas para que se compla la tabla:
de este link: http://msdn.microsoft.com/es-ar/library/csw1x2a6%28v=vs.80%29.aspx
por más que el rnd de 1 o 0 (verdadero o falso) siempre con los dos if logras controlar el resultado.
perdona por no publicar antes, pero, estoy un poco ausente.
saludos!