Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return"ResponseCount",function(t,t2)
- local set={}
- for i=0,2 do for j=0,2 do for k=0,2 do set[''..i..j..k]=0 end end end
- local function f(i)
- local n=''..t2[i-1]..t[i-1]..t[i]
- set[n]=set[n]+1
- end
- for i=2,#t do f(i)end
- return function()
- local r,p,s=0,0,0
- if #t==0 then
- return math.random(3)-1
- elseif #t~=1 then
- f(#t)
- local m=''..t2[#t2]..t[#t]
- r,p,s=set[m..'0'],set[m..'1'],set[m..'2']
- end
- if r>p and r>s then return 1
- elseif p>s and p>r then return 2
- elseif s>p and s>r then return 0
- elseif p>s and p==r then return math.random(2)-1
- elseif s>r and s==p then return math.random(2)
- elseif r>p and r==s then return(math.random(2)+1)%3
- else return math.random(3)-1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment