Tomk
@Tom, can you split these into different threads like that in MWR?
Sure. Next week I'll start a new thread instead of adding on to this one.
13 min read
@Tom, can you split these into different threads like that in MWR?
Wed Oct 20 19:23:41 BST 2010 Wed Oct 20 19:24:11 BST 2010 Wed Oct 20 19:24:43 BST 2010 Wed Oct 20 19:25:14 BST 2010 Wed Oct 20 19:25:30 BST 2010 453x6=2718 correct Wed Oct 20 19:25:44 BST 2010 Wed Oct 20 19:26:12 BST 2010 582x3=1746 correct Wed Oct 20 19:26:16 BST 2010 Wed Oct 20 19:26:48 BST 2010 Wed Oct 20 19:27:20 BST 2010 Wed Oct 20 19:27:55 BST 2010
#!/bin/bash
function debit {
l=8
echo "before -" $y
y=$(($y-$l))
echo "after -"$y"—"$l
}
#===============================================================================
===================
function add {
t=$(($t+1))
}
#===============================================================================
===================
function check {
t=0;q=0;o=0;y=0;j=0;x=0
for j in $a $b $c $d $e $f $g $h; do
x[q]=$j
#echo ${x[q]} >> sumtest.txt
q=$(($q+1))
done
for q in 0 1 2 3 4 5 6 7; do
for o in 1 2 3 4 5 6 7; do
y=$(($q+$o))
if [ $y > $7 ]
then debit; fi
if [ ${x[q]} = ${x[$y]} ]
then add; fi
#echo $q $y" compare "${x[q]}" to "${x[$y]}"–loop–"$o"–count–"$t >> sumtest.txt
done;done
if [ $t = 0 ];then date >> sumtest.txt;echo $a$b$c"x"$d"="$e$f$g$h "correct" >> sumtest.txt; fi
}
#===============================================================================
==================
date >> sumtest.txt
for a in 1 2 3 4 5 6 7 8; do
for b in 1 2 3 4 5 6 7 8; do
for c in 1 2 3 4 5 6 7 8; do
for d in 1 2 3 4 5 6 7 8; do
for e in 1 2 3 4 5 6 7 8; do
for f in 1 2 3 4 5 6 7 8; do
for g in 1 2 3 4 5 6 7 8; do
for h in 1 2 3 4 5 6 7 8; do
k=$(($a$b$c*$d));s=$e$f$g$h;
if [ $s = $k ]
then check; fi
done;done;done;done;done;done;done;date >> sumtest.txt;done
if [ $y > $7 ] then debit; fino matter what i did(spent about 10 hrs trial and error on it) i just could find a way to do a simple "if number => 7 then delete 8 from it"
that's quite long, though don't know anything about bash scriptstakes about 4 1/2 minutes to complete on my machine
s2 := StringReplace(s, ',', '', [rfReplaceAll]);
prod := StrToInt(Copy(s2, 1, 3)) * StrToInt(Copy(s2, 4, 1));
s3 := Copy(s2, 4, 1);
s2 := Copy(s2, 1, 3) + ' * ' + Copy(s2, 4, 1) + ' = ' + IntToStr(prod);
s4 := Copy(s2, 1, 3) + s3 + IntToStr(prod);
if Length(IntToStr(prod)) = 4 then
begin
// remove 0
if Pos('0', Copy(s2, 1, 3) + s3 + IntToStr(prod)) = 0 then
begin
// remove the first char
if Pos(Copy(Copy(s2, 1, 3) + s3 + IntToStr(prod), 1, 1), Copy(Copy(s2, 1, 3) + s3 + IntToStr(prod), 2, Length(Copy(s2, 1, 3) + s3 + IntToStr(prod)))) = 0 then
begin
// remove the 2nd char
if Pos(Copy(s4, 2, 1), Copy(s4, 1, 1) + Copy(s4, 3, length(s4))) = 0 then
begin
// remove the 3nd char
if Pos(Copy(s4, 3, 1), Copy(s4, 1, 2) + Copy(s4, 4, length(s4))) = 0 then
begin
// remove the 4th char
if Pos(Copy(s4, 4, 1), Copy(s4, 1, 3) + Copy(s4, 5, length(s4))) = 0 then
begin
// remove the 5th char
if Pos(Copy(s4, 5, 1), Copy(s4, 1, 4) + Copy(s4, 6, length(s4))) = 0 then
begin
// remove the 6th char
if Pos(Copy(s4, 6, 1), Copy(s4, 1, 5) + Copy(s4, 7, length(s4))) = 0 then
begin
// remove the 7th char
if Pos(Copy(s4, 7, 1), Copy(s4, 1, 6) + Copy(s4, 8, length(s4))) = 0 then
begin
// remove the 8th char
if Pos(Copy(s4, 8, 1), Copy(s4, 1, 7)) = 0 then
begin
// remove number 9
if Pos('9', s4) = 0 then
memo1.lines.add(s2);
end; // 8
end; // 7
end; // 6
end; // 5
end; // 4
end; // 3
end; // 2
end; // 1
end; // 0
end;
end;If I do that, I'd go nuts!However… for a silly game… I can solve it in my head faster than I can type all of that code.
l=7 if [ $y -gt $l ] then debit; finow runs no errors..
How about making it so that's flexible?
Really? I don't think that can be done with whole numbers.???? x ? = ???
This would take 9 integers and we only have 8??? X ? = ?????