نلتقي بود لاتبق سجين اكواد الاوتوبلاي
وفقط ..... فكثير منها تجاوزه الزمن
موفق
وفقط ..... فكثير منها تجاوزه الزمن


tamer=""
v=0
function bel(p, x, g)
if x == 0 then
g(p);else
for i = 1, x do
p[i], p[x] = p[x], p[i]
bel(p, x - 1, g)
p[i], p[x] = p[x], p[i]
end;end;end
function callback(p)
p2=('{'..table.concat(p, ', ')..'}')
if p[1]~=1 and p[2]~=2 and p[3]~=3 and p[4]~=4 and p[5]~=5 then
v=v+1;tamer=tamer..p2.."\r\n"
end;end;bel({1,2,3,4,5}, 5, callback)
Dialog.Message(" عدد الاحتمــــالات = ".. v, tamer);
tamer=""
v=0
function bel(p, x, g)
if x == 0 then
g(p);else
for i = 1, x do
p[i], p[x] = p[x], p[i]
bel(p, x - 1, g)
p[i], p[x] = p[x], p[i]
end;end;end
function callback(p)
p2=('{'..table.concat(p, ', ')..'}')
if p[1]~=1 and p[2]~=2 and p[3]~=3 and p[4]~=4 and p[5]~=5 then
v=v+1;tamer=tamer..p2.."\r\n"
end;end;bel({1,2,3,4,5}, 5, callback)
Dialog.Message(" عدد الاحتمــــالات = ".. v, tamer);
tamer=""
v=0
my_table = {};
function bel(p, x, g)
if x == 0 then
g(p);
else
for i = 1, x do
p[i], p[x] = p[x], p[i]
bel(p, x - 1, g)
p[i], p[x] = p[x], p[i]
end
end
end
function callback(p)
p2=('{'..table.concat(p, ', ')..'}')
if p[1]~=1 and p[2]~=2 and p[3]~=3 and p[4]~=4 and p[5]~=5 then
Table.Insert(my_table,v, p2);
v=v+1
end
end
bel({1,2,3,4,5}, 5, callback)
----------------------------------------------------------------
Input.SetText("Input1",my_table[Math.Random(1,#my_table)]);
----------------------------------------------------------------
tamer=""
v=0
my_table = {};
function bel(p, x, g)
if x == 0 then
g(p);
else
for i = 1, x do
p[i], p[x] = p[x], p[i]
bel(p, x - 1, g)
p[i], p[x] = p[x], p[i]
end
end
end
function callback(p)
p2=('{'..table.concat(p, ', ')..'}')
if p[1]~=1 and p[2]~=2 and p[3]~=3 and p[4]~=4 and p[5]~=5 then
table.insert(my_table,v, p2);
v=v+1
end
end
bel({1,2,3,4,5}, 5, callback)
----------------------------------------------------------------
input.settext("input1",my_table[math.random(1,#my_table)]);
----------------------------------------------------------------
تعليق