![]() ![]() ![]() |
![]() |
|
![]() |
This is an assessed practical exercise. The practical exercises on the course constitute 20% of the final mark of the course. The practical exercises are equally weighted and they are individual practical exercises. This means that your submission should be entirely your own work unless you declare it to be otherwise. Please see the School of Informatics guidelines on plagiarism for further clarification.
You have been hired by Advanced Software Ltd to produce an open-source version of one of their popular games, which they no longer wish to maintain. The problem with the game at present is that it uses unsafe coding practices. Advanced Software Ltd is worried that their share price may fall if it becomes public that some of their developers sometimes use unsafe programming techniques, so a rewrite is necessary. In order to maintain the reputation of the company as a top-shelf software house your program should be portable across the Windows and Linux platforms.
Your task is to modify a C# version of Minesweeper that was ported from the highly-regarded Minesweeper game developed by Chailloux, Manoury and Pagano for the O'Reilly book Développement d'applications avec Objective Caml (version written in Objective Caml). The programmers on the project, who have had mainly C programming experience, have made frequent use of the unsafe keyword in C# to gain access to certain language features. Your project manager believes that none of these unsafe contexts are really necessary, and all could have been coded safely. You are to rewrite the program so that no remaining parts are marked with unsafe. Your refactored application is expected to look and behave as it did before you modified it.
At present, the application will only compile when the unsafe flag for the C# compiler is enabled. Your final program should compile without using this as it should have no code marked as unsafe.
Start by downloading the application source code contained in the Game.cs file. The program can be compiled and executed under both Windows and Linux. You have a choice of which one you use whilst completing the practical, but bear in mind that your result should be portable. In particular, it should compile using Mono on a Linux machine, not only under the latest release of VisualStudio. However, choose whichever development environment you prefer, or you are most used to.
The Minesweeper application depends on a graphics library called GTK#. If you wish to develop on your own machine you will need to get a copy of this library and a C# compiler.
rpm -ql gtk-sharp gtk-sharp-develIf you get the message package gtk-sharp is not installed or package gtk-sharp-devel is not installed then you should contact Informatics support providing a full explanation of the problem. (Use this form.)
When the program code no longer contains any unsafe keywords, you can remove the --unsafe switch from step 1. At that point the program may also work with the Mono JIT so you can try also mono Game.exe. Unsafe code is unlikely to work with the Mono JIT.
When the program code no longer contains any unsafe keywords, you can remove the -unsafe switch from step 4.
This page maintained by Stephen Gilmore.
Last modified: Fri Mar 11 12:24:43 GMT 2005
Last CVS commit: Fri Mar 11 12:24:45 GMT 2005
School of Informatics, Appleton Tower, Crichton Street, Edinburgh, EH8 9LE, Scotland, UK
Tel: +44 131 650 2691, Fax: +44 131 650 6513, E-mail: hod@inf.ed.ac.uk Please contact our webadmin with any comments or corrections. Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh |