PureBytes Links
Trading Reference Links
|
> I run it, and after 3.5 min it finished SUCCESSFULLY.
>
> Here is another discovery. When you have peace of cpu intensive
> eazylang code, You better split it to two or more parts.
Or maybe you can find a less CPU-intensive way to do it.
This is sort of a crude way to do it, but it works, and it's fast.
The attached code produces the same list of numbers as your code
(though not in exactly the same order), but it runs in less than a
second.
I have 6 nested loops, each of which determines which column a
particular digit should fall in. For example, when the variable
"three" has a value of 5, the "3" is placed in the 10^5 position. I
use simple brute-force tests to see if a digit's proposed position is
already in use. Then, since I couldn't think of any way to tell EL
to construct a string with variable amounts of shifting, I used
multiplication. To speed things up a bit I used an array containing
the factors of 10^X. Since I was printing a numeric value, and
there's no way to tell EL to print a leading zero, I printed the
leading zero manually.
Gary
======================
vars: zero(0), one(0), two(0), three(0), four(0), five(0);
array: exp[5](0);
exp[0]=1; exp[1]=10; exp[2]=100; exp[3]=1000; exp[4]=10000; exp[5]=100000;
if lastbaronchart then
for zero = 5 downto 0 begin
for one = 5 downto 0 begin
if one <> zero then
for two = 5 downto 0 begin
if two <> one and two <> zero then
for three = 5 downto 0 begin
if three <> two and three <> one and three <> zero then
for four = 5 downto 0 begin
if four <> three and four <> two and four <> one and four <> zero then
for five = 5 downto 0 begin
if five <> four and five <> three and five <> two and five <> one and five <> zero then
if zero = 5 then print("0",5*exp[five]+4*exp[four]+3*exp[three]+2*exp[two]+1*exp[one]:4:0)
else print(5*exp[five]+4*exp[four]+3*exp[three]+2*exp[two]+1*exp[one]:5:0);
end;
end;
end;
end;
end;
end;
|