This assignment is to be done either individually or in pairs. Do not show your code to any other group and do not look at any other group's code. Do not put your code in a public directory or otherwise make it public. However, you may get help from the TAs or the instructor. You are encouraged to use the LMS Discussions page to post problems so that other students can also answer/see the answers.
In this programming assignment, you will solve the following riddle using logical programming.
Who belongs to the Taekwondo club?
Note for Prolog Programmers:
Your code should be placed in a file called riddle.pl
. Your program should have a student predicate which when queried should give the major of the student who belongs to the Taekwondo club.
Sample Interactions
?- [riddle].
true.
?- student(Major).
Major = .
Notes for Oz Programmers:
You should remove any other Oz installations and use Oz 1.4.0 downloadable from http://sourceforge.net/projects/mozart-oz/files/v1/ and Emacs downloadable from http://gnu.mirror.vexxhost.com/emacs/, to enable the Oz programming interface to find the proper emacs running command such as runemacs.exe, you need to create an environment variable OZEMACS and set its value to for example F:\Programs\emacs-21.1\bin\runemacs.exe
Your final solution should have a one argument procedure called Riddle
. When executing the following Oz code, your program should return the solution in the form of: The < MAJOR > student.
{Browse {SearchOne Riddle}}
See CTM Chapter 9 for relational programming techniques.
Your code should be placed in a file called riddle.oz
In this part, your program should be able to read a text file containing hints in Natural Language similar to the ones in part 1 (The Hints). Your program should then be able to generate rules dynamically by parsing the text file and solve the riddle like you did in part 1. You should be able to query the riddle using Prolog/Mozart's shell.
Note that if you raise the query “student(Major)” before reading/parsing/asserting the hints, it should return multiple student majors.Also, keep in mind that there is more than one way to word the same hint. For example, these two hints mean the same thing:
Note for Prolog Programmers:
Your code should be placed in a file called riddlegenerator.pl
Your program should have a predicate called generateRiddle
that will generate a riddle/rules everytime it's called based on the grammar you feed it in your program.
Sample Interactions
?- [riddlegenerator].
?- generateRiddle("hints.txt").
?- student(Major).
Major = .
Notes for Oz Programmers:
You should remove any other Oz installations and use Oz 1.4.0 downloadable from http://sourceforge.net/projects/mozart-oz/files/v1/ and Emacs downloadable from http://gnu.mirror.vexxhost.com/emacs/, to enable the Oz programming interface to find the proper emacs running command such as runemacs.exe, you need to create an environment variable OZEMACS and set its value to for example F:\Programs\emacs-21.1\bin\runemacs.exe
Your final solution should have a procedure called GenerateRiddle
that will generate a riddle/rules everytime it's called based on hints you feed it in your program.
Your code should be placed in a file called generateriddle.oz
Due Date: Thursday, 12/01, 7:00PM
Grading: The assignment will be graded mostly on correctness, but code clarity / readability will also be a factor (make sure to comment your code!).
Submission Requirements: Please submit a ZIP file with your code, including a README file. README files must be in plain text; markdown is acceptable. Your ZIP file should be named with your LMS user name(s) and chosen language as the filename, either userid1_oz.zip (or userid1_pl.zip) or userid1_userid2_oz.zip (or userid1_userid2_pl.zip). Only submit one assignment per pair via LMS. In the README file, place the names of each group member (up to two). Your README file should also have a list of specific features / bugs in your solution.
Do not include unnecesary files. Test your archive after uploading it. Name your source files appropriately.