DIRECTORY Graphics, GraphicsToPress, MazePrivate; MazeGraphicsImpl: CEDAR PROGRAM IMPORTS Graphics, GraphicsToPress, MazePrivate EXPORTS MazePrivate = PUBLIC BEGIN OPEN MazePrivate; gc: Graphics.Context; p: Graphics.Path; wl: INT ~ 10; ww: INT ~ 1; scaleFactor: REAL ~ wl - ww; strokeWidth: REAL ~ ww / scaleFactor; InitGc: PROC ~ {TRUSTED {gc _ GraphicsToPress.NewContext["maze.press"]}; p _ Graphics.NewPath[]; Graphics.Translate[gc, 72, 72]; Graphics.Scale[gc, scaleFactor, scaleFactor]}; DrawWall: PROC [w: Wall] ~ {x1, x2, y1, y2: INT; SELECT TRUE FROM w.Ns => {x1 _ w.X; x2 _ w.X; y1 _ w.Y - 1; y2 _ w.Y}; w.Ew => {x1 _ w.X - 1; x2 _ w.X; y1 _ w.Y; y2 _ w.Y}; ENDCASE => ERROR; Graphics.MoveTo[p, x1, y1]; Graphics.LineTo[p, x2, y2]; Graphics.DrawStroke[gc, p, strokeWidth, FALSE, square]}; DrawMaze: PROC ~ {InitGc[]; FOR i:INT IN [FirstBlack .. NumWalls) DO TRUSTED {DrawWall[W[i]]} ENDLOOP; Graphics.MoveTo[p, 0, N]; -- northwest Graphics.LineTo [p, 0, 0]; -- southwest Graphics.MoveTo[p, 0, 0, FALSE]; -- empty step to placate Cedar Graphics Graphics.LineTo [p, (M - 1), 0]; -- southeast exit, left Graphics.DrawStroke[gc, p, strokeWidth, FALSE, square]; Graphics.MoveTo[p, M, 0]; -- southeast Graphics.LineTo [p, M, N]; -- northeast Graphics.MoveTo[p, M, N, FALSE]; -- another empty step Graphics.LineTo [p, 1, N]; -- northwest exit, right Graphics.DrawStroke[gc, p, strokeWidth, FALSE, square] ; TRUSTED {GraphicsToPress.Close[gc]}}; END. ¢file: MazeGraphicsImpl.mesa stolen from Greg Nelson's code by Lyle Ramshaw, to fill in a template that was Pascal-to-Mesa translator output, translated at 18-Apr-83 22:36:31 PST Last Edited by: Ramshaw, April 20, 1983 3:59 pm The translate call makes the southwest corner of the maze come out one inch right and one inch up from the southwest corner of the page draw the interior walls: draw the exterior walls: ʘJšœ™JšœN™NJšœF™FJšœ/™/J˜J˜šÏk ˜ J˜ J˜J˜ J˜—Jšœ œœ(œ˜kJšœœ ˜J˜J˜J˜Jšœœ˜ Jšœœ˜ Jšœ œ ˜Jšœ œ˜%J˜šÏnœœ˜šœœ1˜9J˜J˜ JšœU™UJšœ1™1J˜.J˜——šžœœ˜Jšœœ˜šœœ˜˜Jšœ ˜ J˜ J˜ J˜ —˜Jšœ˜J˜ J˜ J˜ —Jšœœ˜—J˜J˜šœ(œ ˜9J˜——šžœœ˜J˜ Jšœ™šœœœ˜(Jšœ œœ˜!—Jšœ™JšœÏc ˜+JšœŸ ˜+JšœœŸ'˜HJšœ#Ÿ˜:Jšœ(œ ˜7JšœŸ ˜*JšœŸ ˜)JšœœŸ˜6JšœŸ˜6Jšœ(œ ˜8šœ˜%J˜——˜J˜—Jšœ˜J˜—…—Ð