Computer System and Programming

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Computer System and Programming

Semester Project

Instructions:
Given below are some ideas that you can choose as your semester project. The semester project
can be done individually or in groups. The number of group members should be
proportional to the difficulty of the project.
If you have any other ideas for the project, then feel free to run it by Sir Jahan Zeb or me first.
The following two points are paramount for the project that you will submit:
a. The code should be well commented and indented.
b. Every member must have proper understanding of the code.
The submission deadline for the project is 3rd of February, 2017. At the time of submission,
there will be a demo of the project and a viva will be conducted alongside it. Project can also
be submitted beforehand if you complete it before the deadline.

The difficulty level, the number of group members and the


quality of the code will determine the final score of the
project.
In case that you find something to be confusing, feel free to ask me.
Project 1:
One method of encoding messages is known as the "expanding square code". This method
encodes a message by placing the character of the message in an odd order square matrix row
by row, and then retrieving them in a clockwise expanding square spiral from the centre of the
matrix. If the message is not exactly the right length to fill the matrix, the rest of the matrix is
filled with asterisk characters (*). For example, the two square matrices below show the order
in which the characters are placed in the matrix, and the order in which they are retrieved.
Notice that the order of retrieval begins at the centre, then proceed to the right, and then spirals
clockwise.

Order In Order Out

1 2 3 4 5 21 22 23 24 25
6 7 8 9 10 20 7 8 9 10
11 12 13 14 15 19 6 1 2 11
16 17 18 19 20 18 5 4 3 12
21 22 23 24 25 17 16 15 14 13

Message In: "This is a test message!!"


Message Out: "stssees a a*!!egmtiThis "

Your program must be able both to encode and to decode messages by this method. A few
things to keep in mind are:
1. There is no defined length of the message.
2. File handling (i.e. saving the encoded message to a text file and reading an encoded
message from the text file) can be added to the project as an added bonus.

Project 2:
This game is very similar to the popular Battleship board game. The game starts with each of
two players placing 5 boats on their own 10x10 grid. Each boat must be placed either vertically
or horizontally on a grid and no boat can overlap another. The boats’ lengths and point values
are as follows:
Carrier – 5 units long, 1 unit wide, 1 point

Battleship – 4 units long, 1 unit wide, 2 points


Frigate – 3 units long, 1 unit wide, 3 points

Submarine – 3 units long, 1 unit wide, 4 points


Minesweeper – 2 units long, 1 unit wide, 5 points
After both grids have five boats positioned on them, each player, starting with the first, takes
turns guessing where the opponent’s ships are on their grid. If the guessed coordinates of the
opponent’s ship is correct, a hit is scored. Only when every piece of a ship has been hit will it
be considered sunk. The game ends after an undetermined number of turns are taken. The
player with the most points wins the game. Points are rewarded only for sunk ships. If the
number of points is equal, the player with the most hits wins. If both players have the same
number of points and hits, the game is a true tie and there is no winner (regardless of total ships
sunk).

A few things to keep in mind are:


1. Graphics (nothing fancy) can be added to make a good UI.
2. File handling (i.e. reading the initial position of the ships, the sequence of the guessed
coordinates etc.) can be added to the project as an added bonus.

Project 3:
Morse code is a sequence of dashes and dots that can be used to represent a message in English.
Each letter in a particular alphabet is represented by a unique pattern of dashes and dots in
Morse code. You can find more details about the Morse code on Wikipedia.
In this project, your job is to create a code that can convert an English string into Morse code.
Then you can either beep the message or flash it (using any graphics library).

Your code should also be able to convert Morse code into English text. (You may not be able
to do it directly. Look up Quinary Form of Morse Code.)
A few things to keep in mind are:

1. Graphics (nothing fancy) can be added to flash the Morse code.


2. File handling (i.e. saving the Morse code in a text file and reading the Quinary form from
a text file.) can be added to the project as an added bonus.

Project 4:
John loves to find words in a 2D puzzle of letters but isn’t very good at it. In this project, you
can write a programme that helps him do so.

The program starts with a 2D grid of 9x9 with randomly generated letters. Then John will type
in a letter to check whether it exists in the grid or not. As an example:

A F M B N D L O D
C F J K W I T C I
D F C O L L E G E
G K M R F D I B O
F C F L J I W Q C
F I A N C U O L F
Q R O T R B C M I
I L I E W Q T N X
S L A F J L I K E
Now, if the John enters CAT, then your program should be able to tell whether it exits in the
puzzle or not. Similarly, if COLLEGE is entered then the program should do the same.

The word can either exist in a straight line or in diagonal.


A few things to keep in mind are:
1. Graphics (nothing fancy) can be added encircle the word if it exists in the puzzle.
2. File handling (i.e. reading a 2D puzzle from a text file) can be added to the project as an
added bonus.

You might also like