Its been a while sine QL Heaven posted. In the QL cyber world there has been an update to the SerUSB drivers, Quanta magazine and QL Today have been published and the first packed QL DVD Rom has been produced by the publishers of QL Today. Definitely and achievement. Here there has been some QLing going on. Since its not clear what new programs would exite and since QL Heaven cannot decide what to write next it has been decided to try to type in some of the old QL World magazine programs and see if they could be updated for the 21st century. Unfortunately typing in listings is a bit like watching paint dry but any way some typing has been done :
10 REMark 3d noughts and crosses
20 :
30 :
40 CLEAR
50 :
60 initialise : REMark all game data and variables
70 display_board true% : REMark display empty board - once only
80 REPeat until_no_more_games
90 init_for_new_game
100 REPeat until_end_of_game
110 IF whos_go% = you% THEN
120 move% = get_your_move
130 ELSE
140 move% = generate_my_move
150 END IF
160 update_board(move%): result%=update_game_tables (move%)
170 IF result% <> game_not_over% THEN EXIT until_end_of_game
180 whos_go% = whos_go%*-1
190 END REPeat until_end_of_game
200 new_game% = game_over (result%)
210 IF NOT new_game% THEN EXIT until_no_more_games
220 display_board false%
230 END REPeat until_no_more_games
240 CLOSE#4 : CLOSE#5 : STOP
250 :
260 :
270 DEFine FuNction generate_my_move
280 LOCal i,j,p%,sq%,my2_count%,your2_count%,val,maxval,pathv
290 CLS #5 : PRINT#5," MY MOVE":PRINT#5," ....KING"
300 IF move%<2 THEN
310 PAUSE 75
320 IF board%(1) = 0 THEN RETurn 1
330 IF board%(4) = 0 THEN RETurn 4
340 END IF
350 IF moves% > 4 THEN
360 p%=0
370 FOR i = 1 TO 76
380 IF pathvalue(i) = me% * 3 THEN RETurn find_square (i)
390 IF pathvalue(i) = you% * 3 THEN p% = i
400 END FOR i
410 IF p% > 0 THEN RETurn find_square (p%)
420 END IF
430 maxval = -1 : sq% = 0
440 FOR i = 1 TO 64
450 IF board%(i) = 0 THEN
500 IF pathv = 2*you% THEN your2_count%= your2_count% + 1
510 val = val +ABS(pathv) = .2 = 5E-2 * (pathv >0)
520 END IF
530 NEXT j
540 IF my2_count% > 1 THEN RETurn 1
550 IF your2_count% > 1 THEN sq% = i * -1
560 IF val >maxval AND sq% >= 0 THEN
570 maxval = val : sq% =i
580 END IF
590 END FOR j
600 END IF
610 END FOR i
620 RETurn ABS(sq%)
630 END DEFine
640 :
There is a lot more to come.
Sunday, 25 September 2011
Thursday, 1 September 2011
QL World SBASIC Programs
Which QL World type in listing SuperBasic programs are worthy of the 21st century. Suggestions please.
Subscribe to:
Posts (Atom)