Subj : Re: more chess To : Rolf Jentsch From : Jasen Betts Date : Mon Nov 26 2001 09:41 pm Hi Rolf. 25-Nov-01 15:47:00, Rolf Jentsch wrote to Jasen.Betts@xspamp42.f531.n640.z3.f RJ> From: email@rolfjentsch.de (Rolf Jentsch) RJ> Jasen.Betts@xspamp42.f531.n640.z3.fidonet.org meinte am 24.11.01 zum RJ> Thema RJ> "more chess" RJ> Hi Jasen RJ> some comments on your batch? ok, it's basically finished (just needs a little polish, and some final tweaks. and changes to get round a couple of bad bugs I found in option... RJ> Here we go >> setdos /b0 >> setdos /b1 RJ> How about one line? because it doesn't work here (possibly a bug in STM when it changes the display mode it also sets the blinking on but doesn't inform 4dos, so if blinking was already off, it takes too rounds of setdos /b to turn blinking off, this difficulty is not evident on the command-line bacause 4dos activates the blink setting before every prompt. >> if %_env ge 799 goto enough >> :moreenv >> c:\4dos\4dos /E:800 /C %0 >> goto end_of_batch RJ> revert question, use comspec, and get rid of goto f.e RJ> if %_env lt 800 (%comspec /e:800 /c %0 %+ quit) RJ> seems to achieve the same goal. here I end up with %_env = 799 after /e:800 so the above would eat all ram then crash. other than that, if comspec isn't pointing to 4dos.com it also won't work near the start of the batch I detect non-4dos using if not 4dos == 4DOS goto moreenv >> alias bad_move=goto get_move RJ> no real need for an alias. A set would have done the same and is probably RJ> faster.... It shouldn't make much difference as the batch is 100% internal commands. the aliases are kept in lower memory (so there's no swapping from ems/xms/disk) a new version actually makes used of some of the alias features to print "error" messages. also %vars are done when 4dos sees the line, but think aliases aren't processed until 4dos get to that part of the line. so there's no accessing of the alias contents until it's needed also aliases should be faster as 4dos doesn't need to use the O/S to access them. >> :redraw >> for x in (0 1 2 3 4 5 6 7) for y in (0 1 2 3 4 5 6 7) set v%x%y=. >> drawbox 0 16 41 73 2 7 on 8 RJ> Make it a subroutine I don't like single-use subroutines. >> :drawboard >> for x in (0 3 6 1 4 7 2 5) do ( >> scrput 0 %@eval[%x*7+20] 1 on 14 %@char[%@eval[%x+65]] >> scrput 41 %@eval[%x*7+20] 1 on 14 %@char[%@eval[%x+65]] >> scrput %@eval[%x*5+3] 16 1 on 14 %@eval[8-%x] >> scrput %@eval[%x*5+3] 73 1 on 14 %@eval[8-%x] >> ) RJ> this one too. I'm rearranging that stuff a bit now. >> if "%mov" == "" bad_move >> switch %mov >> case debug >> set debug=%@if[ "%debug" == "1" ,,1] >> case quit .or. resign >> goto resign RJ> instead of goto use the (set fh.... %+ quit) that has merit... but why is it better than a goto? I was putting the exit-point at the end of the batch... >> if %move ge %fs bad_move >> set move=%@inc[%move] >> gosub read_move %move >> goto drawboard >> case redraw .or. refresh >> goto redraw >> endswitch RJ> drawboard is done in any way, so pull it behind the swich as a RJ> subroutine. It's not done as the default action, i'd have to put a goto to skip over it. drawboard is slow on this machine (100Mhz 486) so I only do it when neccessary, the lastest (unreleased) version of the batch has a one-line drawboard to update minor changes in the display resulting in some speed improvements the spiral drawing is still used at startup as it's not significanlty slower than drawing the pieces in a more mundane order and it's more fun to wait for! (takes about 8 seconds) >> if %y lt 58 (if %[y%b] ne - bad_move %+set y%b=%@eval[56-%y] %+iterate) RJ> does this work? Yes, but it is not easy to understand. RJ> That iff %y lt 58 RJ> then RJ> if %[y%b] ne - bad_move RJ> set y%b=%@eval[56-%y] RJ> iterate RJ> endiff RJ> seems more readable. but it's about 6 times longer, probably about as fast though. that whole section needs rearranging for readibility not sure what the best approach is though, if I split it out into long iffs to gets really long and doesn't fit on the screen. RJ> Here some figure suggestions They got blanked out somewhere en-route. (you might have to uuencode them, or worse, use %@char) base-64 also works, but quoted printable I have to undo by hand :( -=> Bye <=- --- * Origin: Keep grandma off the streets -- legalize bingo. (3:640/531.42) .