

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A project aimed at providing experience in modifying code through a game called munchkin mit. The game simulates the mit experience as a 'card game' where players acquire clue to escape by completing problem sets. Students have properties like sanity, clue, hand of cards, and weapons. Instructions to load the code, create a student, and play the game. It also presents several problems for modification and testing.
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!
This project is aimed at giving you experience modifying code that you did not write. The objective is for you to understand just enough of how the code is working to make the modification. The top of this document describes the system from a high level.
Munchkin MIT is a game that reduces the MIT experience into a "card game" which pits two players against each other to acquire enough clue to escape. The process of acquiring clue requires doing battle with problem sets of varying difficulty. Success results in more clue, failure in a loss of sanity. The game ends when a player reaches 30 clue or runs out of sanity. Weapon cards can be played to make problem sets easier to complete. Load the code advgame.scm. (See supporting files in the Assignments
section). Use M-o to evaluate the whole file. Then play the game:
(play-game nil cards (initial-student "ben") (initial-student "jen"))
A student is a player of the game. A student is composed of a name and a list of properties. These properties include their sanity, their clue, their hand of cards, etc. Create a student with (initial- student "your name here") and test out the selectors student-name and student- value:
(define s (initial-student "Ben")) (student-name s) ;Value: "Ben" (student-value s "sanity") ;Value: 10 (student-value s "clue") ;Value: 0 (student-value s "hand") ;Value: #f
Docsity.com
One property of a student is a hand. A hand is a list of cards that they have not yet played. Another property is weapons, which is the list of weapons that the student has in play. Playing a weapon card puts a weapon in play for that student.
Cards come in a couple of varieties. pset cards are problem sets that students must defeat. weapon cards make it easier for students to defeat problem sets. There exist abstractions for each of these types of cards. The code that implements the effect of the card is in pset-card-proc and weapon-proc.
Play the game. Attempt to win. Attempt to lose. What does sleeping through class do?
Change the game so that the game ends when one player reaches 20 clue instead of 30. Turn in the changes you made.
Change the game so that each player only has 3 cards in their hand not 5. Test your modification to make sure it works and turn in the change you made.
Change the game so that you only get the effect of the STRONGEST weapon you have, not the sum of all their effectiveness. Test your modification to make sure it works and turn in the change you made.
Implement chance cards. A chance card modifies the student's sanity rating (either up or down). Some of the implementation is already completed. Once you've filled in the code for the abstraction, uncomment the lines in the (define cards ...) code at the end of the file and re-evaluate the cards variable. Once you've written the chance-proc you will need to re-evaluate the card-procs definition to make your changes visible to the system. Then play again with the chance cards working.
If you can't figure this one out, don't worry about it.
Docsity.com