|
DataMuseum.dkPresents historical artifacts from the history of: RC4000/8000/9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC4000/8000/9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 2304 (0x900) Types: TextFile Names: »tmmp2«
└─⟦00964e8f7⟧ Bits:30007478 RC8000 Dump tape fra HCØ. └─⟦b2ec5d50f⟧ └─⟦this⟧ »tmmp2«
begin integer array solution,guess(1:4); integer i,j,x,n,m,class,character,digitok,digitincluded; setcombination: for i:= 1 step 1 until 4 do begin random(x); solution(i):= x mod 10; for j:= 1 step 1 until i do if solution(i)=solution(j) and i<>j then i:= i-1 end; write(out,<:master mind program ready<10>:>); next: setposition(out,0,0); i:= 0; for class:= readchar(in,character) while class<>8 and i<4 do begin <* analyze all characters up to <nl> *> if class=2 <* digit *> then begin i:= i+1; guess(i):= character-48 end else if character<>32 <* space *> then begin write(out,<:***syntax error<10>try again<10>:>); goto next end end; if i=0 then goto next; if i<4 then begin write(out,<:***guess not complete<10>try again<10>:>); goto next end; for n:= 2,3,4 do for m:= 1 step 1 until n-1 do if guess(n)=guess(m) then begin write(out,<:***digit duplicated<10>try again<10>:>); goto next end; write(out,<: :>); digitok:= digitincluded:= 0; for i:= 1,2,3,4 do begin for j:= 1,2,3,4 do if guess(i)=solution(j) then begin if i=j then digitok:= digitok+1 else digitincluded:= digitincluded+1 end; write(out,<<dd>,guess(i)) end; write(out,<: => :>, false add 43,digitok, false add 32,4-digitok, false add 45,digitincluded, false add 10,1); if digitok<4 then goto next else begin write(out,<:you got it !!<10>:>); goto setcombination end end ▶EOF◀