|
Post by cntkillme on Jun 14, 2017 19:53:37 GMT
--- CHALLENGE 2 --- -- Goal: call TestPin with a pin such that it returns true. -- Do not alter the TestPin local or your solution is invalidated. -- Your solution must work in Roblox Studio and in standard Lua 5.1. local TestPin do local _pin = tonumber(tostring(function() end):match("%x+$"), 16) local _key = tonumber(tostring(function() end):match("%x+$"), 16) local _attempts = 0 function TestPin(pin) if _attempts < 3 then return pin/_key + _pin == _key else return false end end end -- DO NOT EDIT ANYTHING ABOVE THIS LINE print(TestPin(123456789))
Edit: I've added a 'safeguard' to prevent brute force and altered _pin/_key generation to prevent solutions pertaining to knowing the initial seed.
|
|
|
Post by Bit on Jun 14, 2017 22:22:14 GMT
Got you. local TestPin do local _pin = math.random(1e8, 10e8 - 1) local _key = math.random(1e8, 10e8 - 1) function TestPin(pin) return pin/_key + _pin == _key end end -- DO NOT EDIT ANYTHING ABOVE THIS LINE local inject=setmetatable({},{__div=function(x,y) return setmetatable({},{__add=function() return y end}) end})
print(TestPin(inject))
|
|
|
Post by cntkillme on Jun 16, 2017 8:54:58 GMT
Yuup
|
|