#128674 - 2004-10-30 11:08 PM
Re: This weekend's mini-putt challenge
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
Ja, raining here too.
k, depending on what you mean by only one "statement" in the for loop...
Code:
$a = 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0 for each $ in $a $ ' ' next BTW, you did not forbid any statements outside the for loop.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
Top
|
|
|
|
#128676 - 2004-10-30 11:17 PM
Re: This weekend's mini-putt challenge
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
If that bends the rules, then here's a twist. Code:
for each $ in split('0 ,1 ,2 ,3 ,4 ,5 ,6 ,6 ,5 ,4 ,3 ,2 ,1 ,0 ',',') $ next
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
Top
|
|
|
|
#128682 - 2004-10-31 02:10 PM
Re: This weekend's mini-putt challenge
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Code:
for $=1 to 14
SUBSTR('01234566543210',$,1) " "
next
I guess this does not work as it uses a function. But Les' uses the split function or is it that the function CAN be part of the FOR line?
Edited by Howard Bullock (2004-10-31 02:29 PM)
|
Top
|
|
|
|
#128685 - 2004-10-31 03:19 PM
Re: This weekend's mini-putt challenge
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
ok, back to the script editor and testing window...
|
Top
|
|
|
|
#128686 - 2004-10-31 03:50 PM
Re: This weekend's mini-putt challenge
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Code:
for $=0 to 0
$ " " $+1 " " $+2 " " $+3 " " $+4 " " $+5 " " $+6 " "$+6 " " $+5 " " $+4 " " $+3 " " $+2 " " $+1 " " $
next
Although the loop only executes once, the variable used in the FOR loop is an integral put of the output.
Edited by Howard Bullock (2004-10-31 03:54 PM)
|
Top
|
|
|
|
#128687 - 2004-10-31 04:24 PM
Re: This weekend's mini-putt challenge
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Ok, the current score is 90 ... Would suggest though that this can be done in half the strokes, here's another approach to the problem, this scores a 70
Code:
for $i = 0 to 13 (($i / 7) * (((($i / 7) * 6) - ($i mod 7)) * 2)) + (($i mod 7) - (($i / 7) * 6)) " " next
-Shawn
|
Top
|
|
|
|
#128688 - 2004-10-31 04:32 PM
Re: This weekend's mini-putt challenge
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Ugh mod is an operator...
My feeble mind did not even go there. What math book have you been reading this week?
|
Top
|
|
|
|
#128691 - 2004-11-01 12:06 AM
Re: This weekend's mini-putt challenge
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Howsabout...
Code:
For $ = -13 to 13 Step 2 ($ / 2 + 6 * -($ Mod 2)) * ($ Mod 2) * -1 ' ' Next
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|