//JS pseudo TurboPascal simulator script var x, y; function mygraph() { var i, j, mx=getmaxx, my=getmaxy, n=0; for (i=0; i<=x; i++) { moveto(mx*(i+0.5)/(x+1),0); lineto(mx*(i+0.5)/(x+1),my); } for (j=0; j<=y; j++) { moveto(0,my*(j+0.5)/(y+1)); lineto(mx,my*(j+0.5)/(y+1)); } settextstyle(1,'horizdir',3); settextjustify('center','middle'); for (j=1; j<=y; j++) { for (i=1; i<=x; i++) { outtextxy(mx*i/(x+1),my*j/(y+1),n); n++; } } } function run() { if (nreadln<1) { writeln('This is a simulation of a DOS TurboPascal program.'); write('Type a number between 3 and 9: x = '); readln('x'); return; } if (nreadln<2) { x=parseInt(x); if (isNaN(x)) x=6; write('Type another number between 3 and 9: y = '); readln('y'); return; } if (nreadln<3) { y=parseInt(y); if (isNaN(y)) y=6; initgraph(); mygraph(); readln(''); return; } if (nreadln<4) { closegraph(); writeln(''); write('End of program.'); readln(''); return; } exit(); }