Passion For Puzzles

For people with love and passion for puzzles

 
 
 

Solutions - Digidisc

On this page you will find the code for calculating all solutions for the Digidisc in Turbo Pascal. Please keep in mind that it is written in 1991 !!
Sorry I still did not re-write it in better code.

Back to Solution Overview

PROGRAM digidisc(input,output);

uses crt;

TYPE a = ARRAY [1..4] OF integer;

VAR ro,gr,ge,ra : a;
at,ii,jj,kk,ll,ff,tel1,tel2,tel3,tel4:integer;

PROCEDURE def(VAR ro,gr,ge,ra:a);
BEGIN
ro[1]:=1; ro[2]:=3; ro[3]:=2; ro[4]:=4;
gr[1]:=1; gr[2]:=3; gr[3]:=4; gr[4]:=2;
ge[1]:=1; ge[2]:=4; ge[3]:=2; ge[4]:=3;
ra[1]:=1; ra[2]:=4; ra[3]:=3; ra[4]:=2;
END;

PROCEDURE pluseen(VAR p1,p2,p3,p4:integer);
BEGIN
inc(p1);IF p1=5 THEN p1:=1;
inc(p2);IF p2=5 THEN p2:=1;
inc(p3);IF p3=5 THEN p3:=1;
inc(p4);IF p4=5 THEN p4:=1;
END;

PROCEDURE plus(VAR p5,p6,p7:integer);
BEGIN
inc(p5);IF p5=5 THEN p5:=1;
inc(p6);IF p6=5 THEN p6:=1;
inc(p7);IF p7=5 THEN p7:=1;
END;

PROCEDURE bn(a1,a2,a3,a4:a;kl4,kl1,kl2,kl3:integer);
VARrem1, rem2, rem3, rem4 :a;
BEGIN
rem1:=a1;rem2:=a2;rem3:=a3;rem4:=a4;
FOR ii:=1 TO 4 DO BEGIN
FOR jj:=1 TO 4 DO BEGIN
FOR kk:=1 TO 4 DO BEGIN
FOR ll:=1 TO 4 DO BEGIN
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + a3[tel2] + a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] * a3[tel2] * a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - (a3[tel2] / a4[tel3]))) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] / a3[tel2]) - a4[tel3])) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(9);write(' / ');
textcolor(kl2);write(a3[tel2]);
textcolor(13);write(' - ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + (a3[tel2] * a4[tel3]))) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] * a3[tel2]) / a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - a3[tel2] - a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] / a3[tel2]) + a4[tel3])) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(9);write(' / ');
textcolor(kl2);write(a3[tel2]);
textcolor(13);write(' + ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + (a3[tel2] / a4[tel3]))) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] * a3[tel2]) - a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - a3[tel2] + a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] / a3[tel2] * a4[tel3])) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(9);write(' / ');
textcolor(kl2);write(a3[tel2]);
textcolor(13);write(' * ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + a3[tel2] - a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] * a3[tel2]) + a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - (a3[tel2] * a4[tel3]))) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] / a3[tel2]) / a4[tel3])) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(9);write(' / ');
textcolor(kl2);write(a3[tel2]);
textcolor(13);write(' / ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + a3[tel2] + a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] * a3[tel2] * a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] / a3[tel2]) - a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - (a3[tel2] / a4[tel3]))) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(13);write(' - ');
textcolor(kl2);write(a3[tel2]);
textcolor(9);write(' / ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + (a3[tel2] * a4[tel3]))) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] * a3[tel2]) - a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] / a3[tel2] / a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - a3[tel2] + a4[tel3])) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(13);write(' - ');
textcolor(kl2);write(a3[tel2]);
textcolor(9);write(' + ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + a3[tel2] - a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] * a3[tel2] / a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] / a3[tel2]) + a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - (a3[tel2] * a4[tel3]))) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(13);write(' - ');
textcolor(kl2);write(a3[tel2]);
textcolor(9);write(' * ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] = (a2[tel1] + (a3[tel2] / a4[tel3]))) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] * a3[tel2]) + a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = ((a2[tel1] / a3[tel2]) * a4[tel3])) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] = (a2[tel1] - a3[tel2] - a4[tel3])) THEN BEGIN
textcolor(kl1);write(a2[tel1]);
textcolor(13);write(' - ');
textcolor(kl2);write(a2[tel2]);
textcolor(9);write(' - ');
textcolor(kl3);write(a4[tel3]);
textcolor(15);write(' = ');
textcolor(kl4);write(a1[tel4]);
textcolor(15);writeln;
END;
END;
END;
END;
END;
END;
END;
END;
END;

PROCEDURE ek(a1,a2,a3,a4:a;kl1,kl2,kl3,kl4:integer);
VARrem1, rem2, rem3, rem4 :a;
BEGIN
rem1:=a1;rem2:=a2;rem3:=a3;rem4:=a4;
FOR ii:=1 TO 4 DO BEGIN
FOR jj:=1 TO 4 DO BEGIN
FOR kk:=1 TO 4 DO BEGIN
FOR ll:=1 TO 4 DO BEGIN
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(9);write(' / ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(13);write(' - ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(9);write(' / ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(13);write(' + ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(9);write(' / ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(13);write(' * ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(9);write(' / ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(13);write(' / ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(13);write(' - ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(9);write(' / ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(13);write(' - ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(9);write(' + ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(13);write(' - ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(9);write(' * ');
textcolor(kl4);write(a4[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;a4:=rem4;
tel1:=ii;tel2:=jj;tel3:=kk;tel4:=ll;
IF (a1[tel4] + a2[tel1] = a3[tel2] / a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] * a2[tel1] = a3[tel2] + a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] / a2[tel1] = a3[tel2] * a4[tel3]) THEN BEGIN
pluseen(tel1,tel2,tel3,tel4);
IF (a1[tel4] - a2[tel1] = a3[tel2] - a4[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel4]);
textcolor(13);write(' - ');
textcolor(kl2);write(a2[tel1]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel2]);
textcolor(9);write(' - ');
textcolor(kl4);write(a4[tel3]);
textcolor(15);writeln;
END;
END;
END;
END;
END;
END;
END;
END;
END;

PROCEDURE ber(a1,a2,a3:a;kl1,kl2,kl3:integer);
VARrem1,rem2,rem3:a;
BEGIN
rem1:=a1;rem2:=a2;rem3:=a3;
FOR ii:=1 TO 4 DO BEGIN
FOR jj:=1 TO 4 DO BEGIN
FOR kk:=1 TO 4 DO BEGIN
tel1:=ii;tel2:=jj;tel3:=kk;
IF (a1[tel1] + a2[tel2] = a3[tel3]) THEN BEGIN
plus(tel1,tel2,tel3);
IF (a1[tel1] * a2[tel2] = a3[tel3]) THEN BEGIN
plus(tel1,tel2,tel3);
IF (a1[tel1] - a2[tel2] = a3[tel3]) THEN BEGIN
plus(tel1,tel2,tel3);
IF (a1[tel1] / a2[tel2] = a3[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel1]);
textcolor(9);write(' / ');
textcolor(kl2);write(a2[tel2]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
a1:=rem1;a2:=rem2;a3:=rem3;
tel1:=ii;tel2:=jj;tel3:=kk;
IF (a1[tel1] + a2[tel2] = a3[tel3]) THEN BEGIN
plus(tel1,tel2,tel3);
IF (a1[tel1] * a2[tel2] = a3[tel3]) THEN BEGIN
plus(tel1,tel2,tel3);
IF (a1[tel1] / a2[tel2] = a3[tel3]) THEN BEGIN
plus(tel1,tel2,tel3);
IF (a1[tel1] - a2[tel2] = a3[tel3]) THEN BEGIN
textcolor(kl1);write(a1[tel1]);
textcolor(13);write(' - ');
textcolor(kl2);write(a2[tel2]);
textcolor(15);write(' = ');
textcolor(kl3);write(a3[tel3]);
textcolor(7);writeln;
END;
END;
END;
END;
END;
END;
END;
END;

PROCEDURE bpr;
BEGIN
clrscr;writeln(' -= DIGIDISC =- ');writeln;
END;

PROCEDURE opr;
BEGIN
textcolor(142);write(' * ');textcolor(7);writeln('= ORANGE');
END;

PROCEDURE dm;
BEGIN
bpr;opr;
bn(ro,gr,ge,ra,12,10,14,142);
bn(ro,gr,ra,ge,12,10,142,14);
bn(ro,ge,gr,ra,12,14,10,142);
bn(ro,ge,ra,gr,12,14,142,10);
bn(ro,ra,gr,ge,12,142,10,14);
bn(ro,ra,ge,gr,12,142,14,10);
bn(gr,ro,ge,ra,10,12,14,142);
bn(gr,ro,ra,ge,10,12,142,14);
bn(gr,ge,ro,ra,10,14,12,142);
bn(gr,ge,ra,ro,10,14,142,12);
bn(gr,ra,ro,ge,10,142,12,14);
bn(gr,ra,ge,ro,10,142,14,12);
bn(ge,ro,gr,ra,14,12,10,142);
bn(ge,ro,ra,gr,14,12,142,10);
bn(ge,gr,ro,ra,14,10,12,142);
bn(ge,gr,ra,ro,14,10,142,12);
bn(ge,ra,ro,gr,14,142,12,10);
bn(ge,ra,gr,ro,14,142,10,12);
bn(ra,ro,gr,ge,142,12,10,14);
bn(ra,ro,ge,gr,142,12,14,10);
bn(ra,gr,ro,ge,142,10,12,14);
bn(ra,gr,ge,ro,142,10,14,12);
bn(ra,ge,ro,gr,142,14,12,10);
bn(ra,ge,gr,ro,142,14,10,12);
writeln;
write(' Dit waren alle mogelijkheden. Druk ENTER voor vervolg.');
readln
END;

PROCEDURE tm;
BEGIN
bpr;opr;
ek(ro,gr,ge,ra,12,10,14,142);
ek(ro,gr,ra,ge,12,10,142,14);
ek(ro,ge,gr,ra,12,14,10,142);
ek(ro,ge,ra,gr,12,14,142,10);
ek(ro,ra,gr,ge,12,142,10,14);
ek(ro,ra,ge,gr,12,142,14,10);
ek(gr,ro,ge,ra,10,12,14,142);
ek(gr,ro,ra,ge,10,12,142,14);
ek(gr,ge,ro,ra,10,14,12,142);
ek(gr,ge,ra,ro,10,14,142,12);
ek(gr,ra,ro,ge,10,142,12,14);
ek(gr,ra,ge,ro,10,142,14,12);
ek(ge,ro,gr,ra,14,12,10,142);
ek(ge,ro,ra,gr,14,12,142,10);
ek(ge,gr,ro,ra,14,10,12,142);
ek(ge,gr,ra,ro,14,10,142,12);
ek(ge,ra,ro,gr,14,142,12,10);
ek(ge,ra,gr,ro,14,142,10,12);
ek(ra,ro,gr,ge,142,12,10,14);
ek(ra,ro,ge,gr,142,12,14,10);
ek(ra,gr,ro,ge,142,10,12,14);
ek(ra,gr,ge,ro,142,10,14,12);
ek(ra,ge,ro,gr,142,14,12,10);
ek(ra,ge,gr,ro,142,14,10,12);
writeln;write(' Dit waren alle mogelijkheden. Druk ENTER voor vervolg.');
readln
END;

PROCEDURE em;
BEGIN
bpr;opr;
ber(ro,gr,ge,12,10,14);
ber(ro,gr,ra,12,10,142);
ber(ro,ge,gr,12,14,10);
ber(ro,ge,ra,12,14,142);
ber(ro,ra,gr,12,142,10);
ber(ro,ra,ge,12,142,14);
ber(gr,ro,ge,10,12,14);
ber(gr,ro,ra,10,12,142);
ber(gr,ge,ro,10,14,12);
ber(gr,ge,ra,10,14,142);
ber(gr,ra,ro,10,142,12);
ber(gr,ra,ge,10,142,14);
ber(ge,ro,gr,14,12,10);
ber(ge,ro,ra,14,12,142);
ber(ge,gr,ro,14,10,12);
ber(ge,gr,ra,14,10,142);
ber(ge,ra,ro,14,142,12);
ber(ge,ra,gr,14,142,10);
ber(ra,ro,gr,142,12,10);
ber(ra,ro,ge,142,12,14);
ber(ra,gr,ro,142,10,12);
ber(ra,gr,ge,142,10,14);
ber(ra,ge,ro,142,14,12);
ber(ra,ge,gr,142,14,10);
writeln;write(' This are all the possible solutions. Press ENTER to continue.');
readln
END;
BEGIN
def(ro,gr,ge,ra);
repeat
bpr;
writeln;
writeln(' With this program you can calculate ');
writeln(' ALL solutions for the DIGICUBE ');
writeln;
writeln(' Please make your choice:');
writeln(' [1] STARTERS (4 - 2 = 2)');
writeln(' [2] EXPERIENCED (1 + 2 = 4 - 1)');
writeln(' [3] MASTERS (2 / 1 + 1 = 3)');
writeln;
writeln(' [4] QUIT');
writeln;
write(' Your Choice:');
readln(at);
CASE at OF
1 : em;
2 : tm;
3 : dm;
END;
clrscr;
until at=4;
END.