[RETO] Desofusca mi codigo y dime por que siempre gano ;)

Iniciado por 79137913, Febrero 05, 2013, 11:57:08 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

HOLA!!!

Bueno, el reto es simple, desofusquen mi codigo y diganme donde hago trampa >:D

Código: vb
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!!!
"Algunos creen que soy un bot, puede que tengan razon"
"Como no se puede igualar a Dios, ya he decidido que hacer, ¡SUPERARLO!"
"La peor de las ignorancias es no saber corregirlas"

*Shadow Scouts Team*                                                You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

JAJA , esta difisil la cosa
Para ganar hay que arriesgar

Yo lo desofusque, no es muy complicado pero despues me dio pachorra analizar el codigo xD

Saludos

Febrero 05, 2013, 02:00:38 PM #3 Ultima modificación: Febrero 05, 2013, 02:21:32 PM por 79137913
HOLA!!!

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
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!!!
"Algunos creen que soy un bot, puede que tengan razon"
"Como no se puede igualar a Dios, ya he decidido que hacer, ¡SUPERARLO!"
"La peor de las ignorancias es no saber corregirlas"

*Shadow Scouts Team*                                                You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
HOLA!!!

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
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!


al final se me re pasó, me puse a hacer otras cosas y no terminé.

cuando tenga un rato al pedo lo intento.

saludos!

Febrero 07, 2013, 06:33:25 PM #7 Ultima modificación: Febrero 07, 2013, 06:36:05 PM por [H]arkonnen
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!!!
"Algunos creen que soy un bot, puede que tengan razon"
"Como no se puede igualar a Dios, ya he decidido que hacer, ¡SUPERARLO!"
"La peor de las ignorancias es no saber corregirlas"

*Shadow Scouts Team*                                                You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
HOLA!!!

Felicitaciones, tenemos un GANADOR!

@[H]arkonnen: Publica la respuesta

GRACIAS POR LEER!!!

el truco está acá

Código: text
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:

Código: text
    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:

Código: text
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: You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

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!