- May
- 13,604
- 201
I have a BTM which starts like this.
There are no other ON commands. The body is nested inside 9 DO loops.
In the first run below, when I pressed Ctrl-C, it quit with no message and without unsetting the array (as evidenced by the error when it was restarted). After restarting (the second run below) the first Ctrl-C resulted in the array being unset and the message being echoed but the BTM didn't quit; The second Ctrl-C got it to quit (but with an error because the array had been unset by the first Ctrl-C). The behavior is erratic. The BTM is attached. It plays all possible games of tic-tac-toe and calculates the fraction which end in a win (with occasional progress reports). Well, the server won't let me upload it (A server error occurred. Please try again later.) neither as a BTM nor as a ZIP. Rex, I'll email it to you.
Here's another (on another machine) where it took many attempts before it quit, each time unsetting the array (or trying to) and echoing the message ... except for the last when neither the error message nor the "Quitting" message appeared.
Code:
setlocal
setarray b[9]
on break ( unsetarray b & echo Quitting! & quit )
In the first run below, when I pressed Ctrl-C, it quit with no message and without unsetting the array (as evidenced by the error when it was restarted). After restarting (the second run below) the first Ctrl-C resulted in the array being unset and the message being echoed but the BTM didn't quit; The second Ctrl-C got it to quit (but with an error because the array had been unset by the first Ctrl-C). The behavior is erratic. The BTM is attached. It plays all possible games of tic-tac-toe and calculates the fraction which end in a win (with occasional progress reports). Well, the server won't let me upload it (A server error occurred. Please try again later.) neither as a BTM nor as a ZIP. Rex, I'll email it to you.
Code:
v:\> ttt.btm
15:12:01
8 / 10 = 0.8
37 / 50 = 0.74
101 / 130 = 0.7769230769
129 / 170 = 0.7588235294
^C
v:\> ttt.btm
TCC: V:\ttt.btm [2] Array variable is already defined "b"
15:12:21
8 / 10 = 0.8
37 / 50 = 0.74
101 / 130 = 0.7769230769
129 / 170 = 0.7588235294
158 / 210 = 0.7523809524
185 / 250 = 0.74
^C
Quitting!
236 / 310 = 0.7612903226
236 / 320 = 0.7375
236 / 330 = 0.7151515152
236 / 340 = 0.6941176471
236 / 350 = 0.6742857143
236 / 360 = 0.6555555556
236 / 370 = 0.6378378378
236 / 380 = 0.6210526316
236 / 390 = 0.6051282051
236 / 400 = 0.59
236 / 410 = 0.5756097561
^C
TCC: V:\ttt.btm [26] Not an array variable "b"
Quitting!
v:\>
Here's another (on another machine) where it took many attempts before it quit, each time unsetting the array (or trying to) and echoing the message ... except for the last when neither the error message nor the "Quitting" message appeared.
Code:
v:\> \\zz\h$\Workplace\ttt.btm
15:23:02
8 / 10 = 0.8
37 / 50 = 0.74
101 / 130 = 0.7769230769
129 / 170 = 0.7588235294
158 / 210 = 0.7523809524
185 / 250 = 0.74
252 / 330 = 0.7636363636
^C
Quitting!
270 / 360 = 0.75
270 / 370 = 0.7297297297
270 / 380 = 0.7105263158
270 / 390 = 0.6923076923
270 / 400 = 0.675
270 / 410 = 0.6585365854
270 / 420 = 0.6428571429
270 / 430 = 0.6279069767
270 / 440 = 0.6136363636
270 / 450 = 0.6
270 / 460 = 0.5869565217
270 / 470 = 0.5744680851
^C
TCC: \\zz\h$\Workplace\ttt.btm [74] Not an array variable "b"
Quitting!
270 / 480 = 0.5625
270 / 490 = 0.5510204082
270 / 500 = 0.54
270 / 510 = 0.5294117647
270 / 520 = 0.5192307692
270 / 530 = 0.5094339623
270 / 540 = 0.5
270 / 550 = 0.4909090909
270 / 560 = 0.4821428571
270 / 570 = 0.4736842105
^C
TCC: \\zz\h$\Workplace\ttt.btm [78] Not an array variable "b"
Quitting!
270 / 580 = 0.4655172414
270 / 590 = 0.4576271186
270 / 600 = 0.45
270 / 610 = 0.4426229508
^C
TCC: \\zz\h$\Workplace\ttt.btm [80] Not an array variable "b"
Quitting!
270 / 620 = 0.435483871
270 / 630 = 0.4285714286
270 / 640 = 0.421875
^C
TCC: \\zz\h$\Workplace\ttt.btm [79] Not an array variable "b"
Quitting!
270 / 650 = 0.4153846154
270 / 660 = 0.4090909091
270 / 670 = 0.4029850746
^C
v:\>