\documentstyle{report}

\pagestyle{myheadings}
\def\headlineaux{\sc Math 322: C Programming and Unix
\hrulefill
}
\markboth{\headlineaux}{\headlineaux}

\setlength{\textwidth}{6.25in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}

\newcommand{\assignmentNumber}{4}
\newcommand{\outdate}{11 October, 1994} 
\newcommand{\duedate}{20 October, 1994}

\begin{document}
\begin{titlepage}\begin{centerline}{\Huge \framebox{Burt Rosenberg}}
\end{centerline}\end{titlepage}

\section*{Problem Set \assignmentNumber \hfill{\parbox{3in}
    {\small\sc\begin{flushright} Out: \outdate
     \\ Due: \duedate\end{flushright}}}}


\subsection*{Goals}

Write professional quality code in C, using modules and Makefiles,
using Curses.

\subsection*{Reading Assignment}

Read the handout on Curses.

\subsection*{Programming Assignment}

Give last week's program an enjoyable and educational human
interface. The target is a {\em Morse Code Trainer}, a software
which helps the user learn morse code.

It will be necessary to use advanced techniques to handle I/O.
The terminal must be set to cbreak mode, and then reset after the
program is over. To help with exceptional situations, it is best to
``catch'' the control-C and direct this interrupt to a section of
code which resets the terminal. This can be done as follows.
\begin{verbatim}
#include<curses.h>
#include<signal.h>

int die()       {
/*  when ^C, call this exit routine. */
    /* restore signal */
    signal(SIGINT,SIG_IGN) ;
    printf("Exiting...\n") ;
    /* end curses */
    endwin() ;
    exit(0) ;
}
 
int main( int ac, char * av[] )    {
   /* install exit routine */
   signal(SIGINT,die) ;
   /* start curses */
   initscr() ; crmode() ; noecho() ; nonl() ;
   /* loop until ^C */
   for (;;) ;
}
\end{verbatim}
Compile with \verb;cc filename.c -lcurses -ltermcap;

I don't know exactly how the program should work, you are to
design a user interface. But the program must use command
line switches to support its various options. The
program must include these modes of operation:
\begin{enumerate}
   \item Produce $X$ random letters and wait for the
         user to type in the morse code equivalents.
   \item Produce $X$ random words, a dictionary can be
         found in /usr/dict/words, and wait for the
         user to type in morse code equivalents.
   \item The same as above, but in the opposite direction,
         given morse code words or letters, wait for the
         user to decode.
   \item It should mark and time the user's performance.
   \item A list of errors should be posted to reinforce learning
         of difficult letters.
\end{enumerate}
It would be interesting to divide the screen in portions, to
display the challenge text and the solution, with errors
indicated. Here is a possibility.
\begin{verbatim}
 
---------------- Challenge 1 ------------------------

?>  s     w     t     o     p     a
!>  ...   .--   -     ---   .--.  .-

---------------- Score  -----------------------------

Correct:    15
Incorrect:   3
Time:        5 char/minute

---------------- Your Common Errors -----------------

   b         j
   -...      .---

 
\end{verbatim}

\end{document}
