A Finite Automata Problem

The purpose of this programming assignemnt is to solidify your knowledge of Finite Automata with Output by means of a programming exercise.

A complete description of the problem is included in a memo from your instructor.

What you'll turn in
  1. A floppy disk (3.5") or a CD-ROM which contains:
    • the source file(s) for your program. Please note that grading, as described below, considers both the functionality and the readability of your code. You must follow the coding style and documentation standards used in the Computer Science Department.
    • DOS executable named assign. If you prefer to use UNIX instead, then you shall turn in an executable made for one of the following: Solaris 8 or Linux.
    • README file indicating what the program does, how to build the executable, the platform it's been tested on, and how to run it, plus any other information you consider useful - like the name of the author, known limitations of the application, etc.
    • Two input files (use the extension .din for the name), you have used to test your program (with a minimum of two states each)
    • Output files (with the extension .out) corresponding to the input string 0101001010111010100101.
    • A memo describing your work. You will indicate what you have looked for and how you solved the problem. Direct the memo to your class instructor. Attached to the memo will be a document that introduces the necessary theoretical background.

  2. Hardcopies:
    • The memo with the attached theoretical background
    • A listing of the source code
    • Listings of the sample input files and the corresponding output.

    A professional look of your work is expected. Loose items will be rejected. A binder (or an envelope) to hold your work together is required.

  1. A mark between 0 and 10 for functionality. The mark basically indicates in what measure your program works properly and how well you have followed the initial specification.
  2. A mark between 0 and 10 for readability. This mark indicates how well documented your program is; it also considers the general appearance of your final report.
  3. Multiply the above two marks to get the mark for this programming assignment.

For each business day you turn in your project earlier you receive a 5% bonus. However, penalties increase by 5% as well. You can turn in your assignment up to ten business days ahead of the deadline.

  • You turn in your assignment three days earlier: a 3*5=15% bonus will be added to your assignment mark
  • We find a single mistake in the functionality section and the penalty for that mistake is 0.5 points. Since you have turned the assignment three days earlier than the deadline, the penalty becomes 0.5*(1+3*5%)=0.5*(1+3*0.05)=0.575
  • We calculate the mark by multiplying the marks for the functionality and readability; in your case the mark for functionality is 10-0.575=9.425, and the mark for readability is 10. The result is 9.425*10=94.25
  • We add the bonus to this mark: 94.25+94.25*15%=108.38 which we round to 108. This is your final mark.

You may be asked to do a code review with your instructor.

Department of
Computer Science

DATE: March 17, 2002
TO: CS-330 students
FROM: Virgil Bistriceanu
SUBJECT: Project Description

Dear Student,

I need your help in creating an application that reads the description of a Finite Automata with Output (Moore style) from standard input and then, given an input string -- again from standard input --, outputs (to standard output) the corresponding output string.

For simplicity, the input string will consist only of 0s and 1s.

Here is a description for the input and the output of your program.


The input always begins with a line by itself that reads BEGIN_FA_DESCRIPTION and ends with a line by itself that reads END_FA_DESCRIPTION. Each line in the input, between BEGIN_FA_DESCRIPTION and END_FA_DESCRIPTION, will have the following format:

stateNumber nextStateWhenInputIsZero nextStateWhenInputIsOne outputInThisState

If a stateNumber is preceded by a >, then the state is the start state.

Here is an example of input for a FA with four states:

    >0  1  2  x
     1  3  4  x
     2  3  4  y
     3  3  3  x
     4  3  2  x

After the description of the FA is read from standard input, your application will read (forever) from standard input input strings for the FA. As soon as a line is complete (the user hits Enter) your application will print the output corresponding to the given input and will go to the start state (waiting for more input).


Each line in the output (standard output) corrsponds to an input string.
Using the FA described by the sample above, let's assume the the input string is 01101. Then the corresponding output will be:

Please note that the left-most output letter is the output of the FA in the initial state.


Please note that if your program reads input from standard input then it can get input from a file by using input redirection. Similarly, if the program writes to standard output, then the output can be easily written to a file by using output redirection.

For example, assign < myInputFile.din will get the input from the file named myInputFile.din (< indicates input redirection), and the output will be written to standard output (typically the monitor).

On the other hand, if you do assign > myOutputFile.out then the graph description will come from standard input (typically your keyboard) and the output will be written to myOutputFile.out (> indicates output redirection).

Finally, you can do both input and output redirection at the same time:
assign < myInputFile.din > myOutputFile.out

Have fun,

Last update: March 18, 2002 Virgil Bistriceanu cs330 Computer Science

$Id: assign.html,v 1.1 2002/03/18 13:05:02 virgil Exp $