This repository has been archived by the owner on Sep 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmastermind.as~
3246 lines (3182 loc) · 66 KB
/
mastermind.as~
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%!PS-Adobe-3.0
%%Title: mastermind.as
%%For: Baltasar Dinis
%%Creator: a2ps version 4.14
%%CreationDate: Fri Nov 24 15:20:12 2017
%%BoundingBox: 24 24 571 818
%%DocumentData: Clean7Bit
%%Orientation: Landscape
%%Pages: 8
%%PageOrder: Ascend
%%DocumentMedia: A4 595 842 0 () ()
%%DocumentNeededResources: font Courier
%%+ font Courier-Bold
%%+ font Courier-BoldOblique
%%+ font Courier-Oblique
%%+ font Helvetica
%%+ font Helvetica-Bold
%%+ font Symbol
%%+ font Times-Bold
%%+ font Times-Roman
%%DocumentProcessColors: Black
%%Requirements: Tumble Duplex
%%DocumentSuppliedResources: procset a2ps-a2ps-hdr
%%+ procset a2ps-black+white-Prolog
%%+ encoding ISO-8859-1Encoding
%%EndComments
/a2psdict 200 dict def
a2psdict begin
%%BeginProlog
%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
% Check PostScript language level.
/languagelevel where {
pop /gs_languagelevel languagelevel def
} {
/gs_languagelevel 1 def
} ifelse
% EPSF import as in the Red Book
/BeginInclude {
/b4_Inc_state save def % Save state for cleanup
/dict_count countdictstack def % Count objects on dict stack
/op_count count 1 sub def % Count objects on operand stack
userdict begin
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
gs_languagelevel 1 ne {
false setstrokeadjust false setoverprint
} if
} bind def
/EndInclude {
count op_count sub { pos } repeat % Clean up stacks
countdictstack dict_count sub { end } repeat
b4_Inc_state restore
} bind def
/BeginEPSF {
BeginInclude
/showpage { } def
} bind def
/EndEPSF {
EndInclude
} bind def
% Page prefeed
/page_prefeed { % bool -> -
statusdict /prefeed known {
statusdict exch /prefeed exch put
} {
pop
} ifelse
} bind def
/deffont {
findfont exch scalefont def
} bind def
/reencode_font {
findfont reencode 2 copy definefont pop def
} bind def
% Function c-show (str => -)
% centers text only according to x axis.
/c-show {
dup stringwidth pop
2 div neg 0 rmoveto
show
} bind def
% Function l-show (str => -)
% prints texts so that it ends at currentpoint
/l-show {
dup stringwidth pop neg
0
rmoveto show
} bind def
% center-fit show (str w => -)
% show centered, and scale currentfont so that the width is less than w
/cfshow {
exch dup stringwidth pop
% If the title is too big, try to make it smaller
3 2 roll 2 copy
gt
{ % if, i.e. too big
exch div
currentfont exch scalefont setfont
} { % ifelse
pop pop
}
ifelse
c-show % center title
} bind def
% Return the y size of the current font
% - => fontsize
/currentfontsize {
currentfont /FontType get 0 eq {
currentfont /FontMatrix get 3 get
}{
currentfont /FontMatrix get 3 get 1000 mul
} ifelse
} bind def
% reencode the font
% <encoding-vector> <fontdict> -> <newfontdict>
/reencode { %def
dup length 5 add dict begin
{ %forall
% <vector> <key> <val>
1 index /FID ne
{ def }{ pop pop } ifelse
} forall
/Encoding exch def % -
% Use the font's bounding box to determine the ascent, descent,
% and overall height; don't forget that these values have to be
% transformed using the font's matrix.
% We use `load' because sometimes BBox is executable, sometimes not.
% Since we need 4 numbers an not an array avoid BBox from being executed
/FontBBox load aload pop
FontMatrix transform /Ascent exch def pop
FontMatrix transform /Descent exch def pop
/FontHeight Ascent Descent sub def
% Get the underline position and thickness if they're defined.
% Use 1 if they are not defined.
currentdict /FontInfo 2 copy known
{ get
/UnderlinePosition 2 copy % <FontInfo> /UP <FontInfo> /UP
2 copy known
{ get }{ pop pop 1 } ifelse
0 exch FontMatrix transform exch pop
def % <FontInfo>
/UnderlineThickness 2 copy % <FontInfo> /UT <FontInfo> /UT
2 copy known
{ get }{ pop pop 1 } ifelse
0 exch FontMatrix transform exch pop
def % <FontInfo>
pop % -
}{ pop pop
} ifelse
currentdict
end
} bind def
% composite fonts for ASCII-EUC mixed strings
% Version 1.2 1/31/1990
% Original Ken'ichi HANDA ([email protected])
% Modified Norio Katayama ([email protected]),1998
% Extend & Fix Koji Nakamaru ([email protected]), 1999
% Anyone can freely copy, modify, distribute this program.
/copyfont { % font-dic extra-entry-count copyfont font-dic
1 index maxlength add dict begin
{ 1 index /FID ne 2 index /UniqueID ne and
{def} {pop pop} ifelse
} forall
currentdict
end
} bind def
/compositefont { % ASCIIFontName EUCFontName RomanScale RomanOffset Rot(T/F) compositefont font
/RomanRotation exch def
/RomanOffset exch def
/RomanScale exch def
userdict /fixeucfont_dict known not {
userdict begin
/fixeucfont_dict 2 dict begin
/UpperByteEncoding [
16#00 1 16#20 { pop 0 } for
16#21 1 16#28 { 16#20 sub } for
16#29 1 16#2F { pop 0 } for
16#30 1 16#74 { 16#27 sub } for
16#75 1 16#FF { pop 0 } for
] def
/LowerByteEncoding [
16#00 1 16#A0 { pop /.notdef } for
16#A1 1 16#FE { 16#80 sub 16 2 string cvrs
(cXX) dup 1 4 -1 roll
putinterval cvn } for
/.notdef
] def
currentdict
end def
end
} if
findfont dup /FontType get 0 eq {
14 dict begin
%
% 7+8 bit EUC font
%
12 dict begin
/EUCFont exch def
/FontInfo (7+8 bit EUC font) readonly def
/PaintType 0 def
/FontType 0 def
/FontMatrix matrix def
% /FontName
/Encoding fixeucfont_dict /UpperByteEncoding get def
/FMapType 2 def
EUCFont /WMode known
{ EUCFont /WMode get /WMode exch def }
{ /WMode 0 def } ifelse
/FDepVector [
EUCFont /FDepVector get 0 get
[ 16#21 1 16#28 {} for 16#30 1 16#74 {} for ]
{
13 dict begin
/EUCFont EUCFont def
/UpperByte exch 16#80 add def
% /FontName
/FontInfo (EUC lower byte font) readonly def
/PaintType 0 def
/FontType 3 def
/FontMatrix matrix def
/FontBBox {0 0 0 0} def
/Encoding
fixeucfont_dict /LowerByteEncoding get def
% /UniqueID
% /WMode
/BuildChar {
gsave
exch dup /EUCFont get setfont
/UpperByte get
2 string
dup 0 4 -1 roll put
dup 1 4 -1 roll put
dup stringwidth setcharwidth
0 0 moveto show
grestore
} bind def
currentdict
end
/lowerbytefont exch definefont
} forall
] def
currentdict
end
/eucfont exch definefont
exch
findfont 1 copyfont dup begin
RomanRotation {
/FontMatrix FontMatrix
[ 0 RomanScale neg RomanScale 0 RomanOffset neg 0 ]
matrix concatmatrix def
}{
/FontMatrix FontMatrix
[ RomanScale 0 0 RomanScale 0 RomanOffset ] matrix concatmatrix
def
/CDevProc
{pop pop pop pop 0 exch -1000 exch 2 div 880} def
} ifelse
end
/asciifont exch definefont
exch
/FDepVector [ 4 2 roll ] def
/FontType 0 def
/WMode 0 def
/FMapType 4 def
/FontMatrix matrix def
/Encoding [0 1] def
/FontBBox {0 0 0 0} def
% /FontHeight 1.0 def % XXXX
/FontHeight RomanScale 1.0 ge { RomanScale }{ 1.0 } ifelse def
/Descent -0.3 def % XXXX
currentdict
end
/tmpfont exch definefont
pop
/tmpfont findfont
}{
pop findfont 0 copyfont
} ifelse
} def
/slantfont { % FontName slant-degree slantfont font'
exch findfont 1 copyfont begin
[ 1 0 4 -1 roll 1 0 0 ] FontMatrix exch matrix concatmatrix
/FontMatrix exch def
currentdict
end
} def
% Function print line number (<string> # -)
/# {
gsave
sx cw mul neg 2 div 0 rmoveto
f# setfont
c-show
grestore
} bind def
% -------- Some routines to enlight plain b/w printings ---------
% Underline
% width --
/dounderline {
currentpoint
gsave
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
0 rlineto
stroke
grestore
} bind def
% Underline a string
% string --
/dounderlinestring {
stringwidth pop
dounderline
} bind def
/UL {
/ul exch store
} bind def
% Draw a box of WIDTH wrt current font
% width --
/dobox {
currentpoint
gsave
newpath
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
dup 0 rlineto
0 currentfont /FontHeight get currentfontsize mul rlineto
neg 0 rlineto
closepath
stroke
grestore
} bind def
/BX {
/bx exch store
} bind def
% Box a string
% string --
/doboxstring {
stringwidth pop
dobox
} bind def
%
% ------------- Color routines ---------------
%
/FG /setrgbcolor load def
% Draw the background
% width --
/dobackground {
currentpoint
gsave
newpath
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
dup 0 rlineto
0 currentfont /FontHeight get currentfontsize mul rlineto
neg 0 rlineto
closepath
bgcolor aload pop setrgbcolor
fill
grestore
} bind def
% Draw bg for a string
% string --
/dobackgroundstring {
stringwidth pop
dobackground
} bind def
/BG {
dup /bg exch store
{ mark 4 1 roll ] /bgcolor exch store } if
} bind def
/Show {
bg { dup dobackgroundstring } if
ul { dup dounderlinestring } if
bx { dup doboxstring } if
show
} bind def
% Function T(ab), jumps to the n-th tabulation in the current line
/T {
cw mul x0 add
bg { dup currentpoint pop sub dobackground } if
ul { dup currentpoint pop sub dounderline } if
bx { dup currentpoint pop sub dobox } if
y0 moveto
} bind def
% Function n: move to the next line
/n {
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
% Function N: show and move to the next line
/N {
Show
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
/S {
Show
} bind def
%%BeginResource: procset a2ps-a2ps-hdr 2.0 2
%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
% Function title: prints page header.
% <ct> <rt> <lt> are passed as argument
/title {
% 1. Draw the background
x v get y v get moveto
gsave
0 th 2 div neg rmoveto
th setlinewidth
0.95 setgray
pw 0 rlineto stroke
grestore
% 2. Border it
gsave
0.7 setlinewidth
pw 0 rlineto
0 th neg rlineto
pw neg 0 rlineto
closepath stroke
grestore
% stk: ct rt lt
x v get y v get th sub 1 add moveto
%%IncludeResource: font Helvetica
fHelvetica fnfs 0.8 mul scalefont setfont
% 3. The left title
gsave
dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
fnfs 0.8 mul hm rmoveto
show % left title
grestore
exch
% stk: ct ltw rt
% 4. the right title
gsave
dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
dup
pw exch stringwidth pop fnfs 0.8 mul add sub
hm
rmoveto
show % right title
grestore
% stk: ct ltw rtw
% 5. the center title
gsave
pw 3 1 roll
% stk: ct pw ltw rtw
3 copy
% Move to the center of the left room
sub add 2 div hm rmoveto
% What is the available space in here?
add sub fnfs 0.8 mul sub fnfs 0.8 mul sub
% stk: ct space_left
%%IncludeResource: font Helvetica-Bold
fHelvetica-Bold fnfs scalefont setfont
cfshow
grestore
} bind def
% Function border: prints virtual page border
/border { %def
gsave % print four sides
0 setgray
x v get y v get moveto
0.7 setlinewidth % of the square
pw 0 rlineto
0 ph neg rlineto
pw neg 0 rlineto
closepath stroke
grestore
} bind def
% Function water: prints a water mark in background
/water { %def
gsave
scx scy moveto rotate
%%IncludeResource: font Times-Bold
fTimes-Bold 100 scalefont setfont
.97 setgray
dup stringwidth pop 2 div neg -50 rmoveto
show
grestore
} bind def
% Function rhead: prints the right header
/rhead { %def
lx ly moveto
fHelvetica fnfs 0.8 mul scalefont setfont
l-show
} bind def
% Function footer (cf rf lf -> -)
/footer {
fHelvetica fnfs 0.8 mul scalefont setfont
dx dy moveto
show
snx sny moveto
l-show
fnx fny moveto
c-show
} bind def
%%EndResource
%%BeginResource: procset a2ps-black+white-Prolog 2.0 1
% Function T(ab), jumps to the n-th tabulation in the current line
/T {
cw mul x0 add y0 moveto
} bind def
% Function n: move to the next line
/n { %def
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
% Function N: show and move to the next line
/N {
Show
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
/S {
Show
} bind def
/p {
false UL
false BX
fCourier bfs scalefont setfont
Show
} bind def
/sy {
false UL
false BX
fSymbol bfs scalefont setfont
Show
} bind def
/k {
false UL
false BX
fCourier-Oblique bfs scalefont setfont
Show
} bind def
/K {
false UL
false BX
fCourier-Bold bfs scalefont setfont
Show
} bind def
/c {
false UL
false BX
fCourier-Oblique bfs scalefont setfont
Show
} bind def
/C {
false UL
false BX
fCourier-BoldOblique bfs scalefont setfont
Show
} bind def
/l {
false UL
false BX
fHelvetica bfs scalefont setfont
Show
} bind def
/L {
false UL
false BX
fHelvetica-Bold bfs scalefont setfont
Show
} bind def
/str{
false UL
false BX
fTimes-Roman bfs scalefont setfont
Show
} bind def
/e{
false UL
true BX
fHelvetica-Bold bfs scalefont setfont
Show
} bind def
%%EndResource
%%EndProlog
%%BeginSetup
%%IncludeResource: font Courier
%%IncludeResource: font Courier-Oblique
%%IncludeResource: font Courier-Bold
%%IncludeResource: font Times-Roman
%%IncludeResource: font Symbol
%%IncludeResource: font Courier-BoldOblique
%%BeginResource: encoding ISO-8859-1Encoding
/ISO-8859-1Encoding [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus /comma /minus /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /less /equal /greater /question
/at /A /B /C /D /E /F /G
/H /I /J /K /L /M /N /O
/P /Q /R /S /T /U /V /W
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
/quoteleft /a /b /c /d /e /f /g
/h /i /j /k /l /m /n /o
/p /q /r /s /t /u /v /w
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclamdown /cent /sterling /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /bullet
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
] def
%%EndResource
% Initialize page description variables.
/sh 595 def
/sw 842 def
/llx 24 def
/urx 818 def
/ury 571 def
/lly 24 def
/#copies 1 def
%% Pagedevice definitions:
countdictstack
% Push our own mark, since there can be several PS marks pushed depending
% where the failure really occured.
/a2ps_mark
{
%%BeginFeature: *Tumble False
(<<) cvx exec /Tumble (false) cvx exec (>>) cvx exec setpagedevice
%%EndFeature
%%BeginFeature: *Duplex True
(<<) cvx exec /Duplex (true) cvx exec (>>) cvx exec setpagedevice
%%EndFeature
} stopped
% My cleartomark
{ /a2ps_mark eq { exit } if } loop
countdictstack exch sub dup 0 gt
{
{ end } repeat
}{
pop
} ifelse
/th 15.000000 def
/fnfs 11 def
/bfs 8.005733 def
/cw 4.803440 def
% Dictionary for ISO-8859-1 support
/iso1dict 8 dict begin
/fCourier ISO-8859-1Encoding /Courier reencode_font
/fCourier-Bold ISO-8859-1Encoding /Courier-Bold reencode_font
/fCourier-BoldOblique ISO-8859-1Encoding /Courier-BoldOblique reencode_font
/fCourier-Oblique ISO-8859-1Encoding /Courier-Oblique reencode_font
/fHelvetica ISO-8859-1Encoding /Helvetica reencode_font
/fHelvetica-Bold ISO-8859-1Encoding /Helvetica-Bold reencode_font
/fTimes-Bold ISO-8859-1Encoding /Times-Bold reencode_font
/fTimes-Roman ISO-8859-1Encoding /Times-Roman reencode_font
currentdict end def
/bgcolor [ 0 0 0 ] def
/bg false def
/ul false def
/bx false def
% The font for line numbering
/f# /Helvetica findfont bfs .6 mul scalefont def
/fSymbol /Symbol findfont def
/hm fnfs 0.25 mul def
/pw
cw 81.400000 mul
def
/ph
501.959430 th add
def
/pmw urx llx sub pw 2 mul sub 1 div def
/pmh 0 def
/v 0 def
/x [
0
dup pmw add pw add
] def
/y [
pmh ph add 0 mul ph add
dup
] def
/scx sw 2 div def
/scy sh 2 div def
/snx urx def
/sny lly 2 add def
/dx llx def
/dy sny def
/fnx scx def
/fny dy def
/lx snx def
/ly ury fnfs 0.8 mul sub def
/sx 0 def
/tab 8 def
/x0 0 def
/y0 0 def
%%EndSetup
%%Page: (1-2) 1
%%BeginPageSetup
/pagesave save def
sh 0 translate 90 rotate
%%EndPageSetup
iso1dict begin
gsave
llx lly 12 add translate
/v 0 store
/x0 x v get 3.362408 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
(;;; Projeto IAC) c n
(;;; Master Mind) N
(;;; Primeira Entrega) N
(;;; 27/10/2017) N
() p n
(;;; Baltasar Dinis 89416) c n
(;;; Vasco Rodrigues 89557) N
() p n
() N
(;zona 1: constantes) c n
() p n
(filtro) S 8 T () S 16 T () S
(EQU) K
() p 24 T (0007h ) S
(; filtro para os primeiros 3 bits) c n
(mascara ) p 16 T () S
(EQU) K
() p 24 T (1000000000010110b ) S
(; mascara para usar no modulo random) c n
() p n
(SP_INICIAL) S 16 T () S
(EQU) K
() p 24 T (FDFFh ) S
(; stack pointer) c n
(IO_READ) p 8 T () S 16 T () S
(EQU) K
() p 24 T (FFFFh ) S
(; input janela de texto) c n
(IO_WRITE) p 16 T () S
(EQU) K
() p 24 T (FFFEh ) S
(; output janela de texto) c n
(IO_STATUS) p 16 T () S
(EQU) K
() p 24 T (FFFDh ) S
(; testa se foi premida tecla na janela de texto) c n
(IO_CONTROL) p 16 T () S
(EQU) K
() p 24 T (FFFCh ) S
(; posiciona o cursor na janela de texto) c n
(IO_SW ) p 8 T () S 16 T () S
(EQU) K
() p 24 T (FFF9h ) S
(; 8 interruptores \(alavancas\)) c n
(IO_LEDS) p 8 T () S 16 T () S
(EQU) K
() p 24 T (FFF8h ) S
(; 16 leds \(1 por bit\)) c n
(LCD_WRITE) p 16 T () S
(EQU) K
() p 24 T (FFF5h ) S
(; escreve caracter no display) c n
(LCD_CONTROL) p 16 T () S
(EQU) K
() p 24 T (FFF4h ) S
(; colocar o cursor no display) c n
(IO_DISPLAY) p 16 T () S
(EQU) K
() p 24 T (FFF0h ) S
(; display de 7 leds) c n
(TEMP) p 8 T () S 16 T () S
(EQU) K
() p 24 T (FFF7h ) S
(; start/stop temporizador) c n
(TEMP_VALUE) p 16 T () S
(EQU) K
() p 24 T (FFF6h ) S
(; valor para gerar interrup\303\247\303\243o) c n
(INT) K
(_MASK_ADDR) p 16 T () S
(EQU) K
() p 24 T (FFFAh) N
(INT) K
(_MASK) p 16 T () S
(EQU) K
() p 24 T (8000h ) N
(SPACE) S 8 T () S 16 T () S
(EQU) K
() p 24 T (' ' ) S
(; codigo ascii do caracter de espa\303\247o) c n
(ZERO) p 8 T () S 16 T () S
(EQU) K
() p 24 T ('0' ) S
(; codigo ascii do zero) c n
(NROUNDS_LOST) p 16 T () S
(EQU) K
() p 24 T (13 ) S
(; pontuacao correspondente a uma jogada perdida; acab) c n
(a a contagem quando o contador for igual a pontuacao de perder o jogo) N
(NROUNDS_MAX) p 16 T () S
(EQU) K
() p 24 T (12 ) S
(; pontuacao minima, correspondente ao numero maximo d) c n
(e rondas) N
(TEMP_STEP) p 16 T () S
(EQU) K
() p 24 T (10 ) S
(; numero que e colocado no temporizador. Atua como re) c n
(gulador da dificuldade do jogo. Quanto mais pequeno mais dificil) N
( ) p n
(;zona 2: variaveis) c n
() p n
() S 8 T () S 16 T () S
(ORIG) K
() p 24 T (8000h) N
() N
(; os valores utilizados pelo jogo sao declarados ) c n
(; como variaveis para evitar a volatilidade dos registos) N
(; sao utilizados apenas como meio inicial de passagem de parametros) N
(; e como meio final de retorno de parametros) N
() p n
(; o utilizador introduz, pelo meio da placa do P3, a jogada, e esta fica) c n
(; guardada em memoria) N
(;) N
(; o codigo, sempre que recalculado, e guardado em memoria) N
(;) N
(; o resultado \(da verificacao\) fica guardado em memoria) N
(;) N
(; a semente e acedida e escrita pela funcao random, para garantir que,) N
(; no caso de multiplas chamadas, o numero e diferente) N
(; a funcao get_seed inicializa a semente com o valor do temporizador) N
(;) N
(; a melhor pontuacao e inicializada em memoria com o valor) N
(; mais baixo que o jogador pode ter, correspondendo ao valor de uma derrota) N
(;) N
(; a pontuacao atual e guardada em memoria) N
(;) N
(mastermind.as) (Page 1/15) (Nov 24, 17 14:37) title
border
/v 1 store
/x0 x v get 3.362408 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
(; o tempo restante para o jogador efetuar a sua jogada e guardado em memoria) c n
(;) N
(; o temporizador esta guardado em memoria) N
(;) N
(; cursor mimica o funcionamento do porto de controlo da janela de texto) N
() p n
(jogada) S 8 T () S 16 T () S
(TAB) K
() p 24 T (1) N
(codigo) S 8 T () S 16 T () S
(TAB) K
() p 24 T (1) N
(resultado) S 16 T () S
(TAB) K
() p 24 T (1) N
(semente) S 8 T () S 16 T () S
(TAB) K
() p 24 T (1 ) N
(melhor_pont) S 16 T () S
(WORD) K
() p 24 T (NROUNDS_LOST) N
(pont_atual) S 16 T () S
(WORD) K
() p 24 T (1 ) N
(tempo_restante) S 16 T () S
(WORD) K
() p 24 T (FFFFh ) N
(temporizador) S 16 T () S
(TAB) K
() p 24 T (1 ) N
(cursor) S 8 T () S 16 T () S
(WORD) K
() p 24 T (0000h) N
( ) N
() N
(; mensagens ) c n
(inicia_jogo) p 16 T () S
(STR) K
() p 24 T ('Carregue no botao IA para iniciar|') N
(ganhou) S 8 T () S 16 T () S
(STR) K
() p 24 T ('You won!|') N
(perdeu) S 8 T () S 16 T () S
(STR) K
() p 24 T ('You lost... Good luck next time|') N
() N
() N
(;zona 3: interrupcoes) c n
() p n
() S 8 T () S 16 T () S
(ORIG) K
() p 24 T (FE01h) N
(INT) K
(1) p 8 T () S 16 T () S
(WORD) K
() p 24 T () S
(INT) K
(1F) p n
(INT) K
(2) p 8 T () S 16 T () S
(WORD) K
() p 24 T () S
(INT) K
(2F) p n
(INT) K
(3) p 8 T () S 16 T () S
(WORD) K
() p 24 T () S
(INT) K
(3F) p n
(INT) K
(4) p 8 T () S 16 T () S
(WORD) K
() p 24 T () S
(INT) K
(4F) p n
(INT) K
(5) p 8 T () S 16 T () S
(WORD) K
() p 24 T () S
(INT) K
(5F) p n
(INT) K
(6) p 8 T () S 16 T () S
(WORD) K
() p 24 T () S