-
Notifications
You must be signed in to change notification settings - Fork 0
/
mastermind3b.bas
executable file
·56 lines (55 loc) · 1.1 KB
/
mastermind3b.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#if 0
c++ -pipe -xc++ -fpermissive -w -o "${0%.*}".exe "$0" && ./"${0%.*}.exe" ; exit $?
#endif
#include "ptsvubas.cc"
BEGINBASIC(int,main,(int argc, char* argv[]))
10 PRINT "MASTERMIND 3.0";
20 RANDOMIZE;
30 DIM A(12);
40 FOR I=0 TO 3;
50 LET A(I)=1+RND(6);
60 NEXT I;
70 FOR I=8 TO 11;
80 LET A(I)=0;
90 NEXT I;
100 FOR I=4 TO 7;
110 LET A(I)=A(I-4);
120 NEXT I;
130 LET B=0;
140 LET C=0;
150 PRINT "TIPP:",CHR$(0);
160 INPUT K;
170 LET L=K;
180 IF (K>6999) OR (K<1000) THEN 70;
190 LET A(8)=A(8)+1;
200 LET K=K-1000;
210 IF K>999 THEN 190;
220 IF (K>699) OR (K<100) THEN 70;
230 LET A(9)=A(9)+1;
240 LET K=K-100;
250 IF K>99 THEN 230;
260 IF (K>69) OR (K<10) THEN 70;
270 LET A(10)=A(10)+1;
280 LET K=K-10;
290 IF K>9 THEN 270;
300 IF (K>6) OR (K<1) THEN 70;
310 LET A(11)=K;
320 FOR I=0 TO 3;
330 IF A(I)!=A(I+8) THEN 370;
340 LET A(I+4)=0;
350 LET B=B+1;
360 LET A(I+8)=9;
370 NEXT I;
380 FOR I=4 TO 7;
390 FOR J=8 TO 11;
400 IF A(I)!=A(J) THEN 440;
410 LET A(J)=9;
420 LET C=C+1;
430 LET A(I)=0;
440 NEXT J;
450 NEXT I;
460 PRINT L," BLACK:",B," WHITE:",C;
470 IF B<4 THEN 70;
480 PRINT "GRATULALOK!";
490 END;
ENDBASIC