Contributing 10%, marked out of 30, due 12noon Fri 13th February.
These exercises focus on the design and implementation of a larger data structure and supporting functions in C99, and the design, implementation, and creation of common code libraries under the Linux operating system. In particular, successful completion of the questions will again enhance your understanding of C's pointers and structures, and your understanding of the Linux online manuals.
Develop each solution in one or more files in its own directory, each with its own Makefile.
|
How to submit your work:
The following sequence of Linux commands should be used to submit your work by the deadline:
|
Grading will focus on the correctness of your solutions, but will also consider good coding style - including consistent formatting, selection of identifier names, and use of meaningful comments.
Good luck.
Chris McDonald
February 2009.
The simple game jawbreaker is often seen on Windows-CE based PDAs and mobile phones. It is a little like the game tetris in that the objective is to maximize your score by arranging (falling) items. While tetris requires you to arrange the falling items, jawbreaker requires you to select sets of adjacent, identically colored items to make them fall.
A number of items form a set, iff:
The game proceeds as follows:
jawbreaker [nrows ncolumns]
The directory http://www.cs.dartmouth.edu/~chris/cs23/jawbreaker/ contains some files to get you started - take a copy of all files.
Complete your program by 12noon Wednesday 11th. and place a copy of it in your home directory with the following commands:
cp jawbreaker ~/jawbreaker
chmod 755 ~/jawbreaker
this will enable other students to copy and execute your program,
but they will not be able to see your source code.
Testers should just run and test other students' programs,
but should not look at the code.
|
You may exprience some difficulties getting your application to display
the graphical output, depending on where you're working and what software
you have installed on you laptops.
If sitting at a Linux machine in S.001, then you will need to compile and link your jawbreaker on a machine that has the Tcl/Tk libraries installed (e.g. moose.cs.dartmouth.edu). Login to moose with:
ssh -X moose.cs.dartmouth.edu
....develop, compile and link your program (logged into moose)
./jawbreaker (logged into moose)
If working on your own Linux or Macintosh laptop, the above command sequence should also work from anywhere on campus. |
You should test the code of the student immediately after you from this list.
Here, marks are not being awarded, or deducted, for the success or failure of the other student's program. Marks are awarded for your description of how their program performs against your tests.
Write your test-report as a simple ASCII-text file, do not submit it as an MS-Word document nor as HTML.
#include <stdlib.h>
int hash(char *str)
{
int h = 0;
while(*str) {
h = h * 8 + *str ;
++str;
}
return( abs(h) );
}
Design and develop code to implement a dictionary using a hash table. We will need code to add new definitions, to determine if a requested definition exists, and to fetch a requested definition. For simplicity, assume that we'll never remove definitions. Firstly, test your implementation with some simple data such as:
H <tab> hydrogen
He <tab> helium
Li <tab> lithium
Be <tab> beryllium
Then (and this is the main exercise) develop one or more sets of test data that thoroughly test your implementation. In a separate (plain text) file, explain how each of your chosen data sets tests your implementation.
Consider a text file of data consisting of a number of lines of four integers each. Each line contains the non-negative x, y, and z integer coordinates of a point in a rectangular prism (it is not necessarily a cube). Each line of 3 coordinates also contains a single data measurement taken at those coordinates - it could be the temperature, radiation intensity, or air pressure from inside a nuclear reactor. Any data points not explicitly provided are considered to have the value zero.
The data has been captured by a device that flys around randomly in the 3D space, and so the data points "arrive" in any order. As such, you don't really know the bounds of the 3D space until you've finished reading all of the data. However, you only have time to read and record the data items once (as the reactor melts down!) so you'll need to build a 3D data structure "on the fly".
Write a program which is able to read in all of the data points, dynamically growing a 3D data structure to hold the rectangular prism of data as necessary.
This question is actually developing a 3-D version of our TSV library. Could we develop an N-D version?