Reference no: EM1327198
Assignment in C: You will write a program that draws a single level for a "Roguelike" computer game. The program will parse a line of input text from an input file (room.txt), use the parsed text to determine the shape of the room and its contents and then draw the room. The input text file will have 6 rooms and your program should draw all six of them. Your program should also allow the user to move the hero around the rooms and pick up the treasure.
Starting
? Play Rogue for a half hour so that you get the idea of what you are building. The source code is in the examples repo.
? The string tokenizer (strtok) will be extremely useful for this assignment. Google has lots of good info about how to use it.
? Set up your assignment folder (A3). Make sure you have all of the required folders (bin, src, include, assets, docs). The input file will go in the assets folder.
? Write a program to read a line from a file and parse the line into the dimensions, doors and items for a room. Musts: do all of these to get a mark greater than zero
? Your solution must take the name of an input file as a command line parameter and use that file to draw the level.
? Your solution must use the character set from Rogue 3.6.3
? Your solution must compile without errors or warnings, must run without crashing or segfaulting
? Your soution must draw at least the outline of the first room in the test file
? Have a README file and a makefile
The Basics: 80%
Expectations for your game
? Correctly draw the room and all of the contents and doors
? Allow the hero to move around the room using the w,a,s,d keys.
? Permit the hero to pick up items by walking over them. Print the list of things the hero has picked up when the program exits.
? Prevent the hero from walking through walls or over monsters. (no need to implement any sort of combat with monsters though)
? Allow the hero to walk onto doors and stairs. Doors should not be picked up and neither should stairs.
? When the hero walks onto a door, move the hero to the room closest to that door (unless you have created a hallway drawing algorithm).Expectations for your code
? Use the ncurses library
? Use structs
? Use dynamically allocated memory and pointers
? Submission folder has src/ include/ docs/ assets/ and bin/ subdirectories that are used properly
? Source code is divided properly into .c and .h files
? Each .c file has the required header (see the policies document)
? Source code is properly indented
? Comments about function input/output and purpose are in .h files
? Comments about algorithm logic are in .c files
? Variable and function names are meaningful and are in camelCase
? A plain text file called README is in the root folder. It contains information about running and using your program as well as any known limitations of the program.
? You have a makefile that will compile your code and place the executable in the bin folder.
? Your code must compile with no error or warning messages using the ansi and Wall flags in gcc
? Have separate source files for groups of tasks that repeat, such as dealing with operations for the room, parsing, drawing, and reading the file. Have a separate file for main
? your reference list and testing document are in the docs folder and contain appropriate information.
Details about Input File
? The input file will contain six rooms. You should draw the rooms 3 across and 2 down. No room will be larger than 20 rows X 25 columns.
? Each line of the file will consist of a spacedelimited line of text, no longer than 150 characters.
? Lines will not have a space at the beginning but may have trailing spaces and may have more than one space between elements.
? Lines will always have a newline at the end.
? The first element of the input string will ALWAYS be the room dimensions give as RowsXColumns (i.e. 10X12)
? The other possible elements can be in any order
? Door elements will begin with a lowercase d followed by a letter representing the wall that the door is in, followed by a position measured from north or west. e.g. de3 is a door in the east wall in position three from the north edge (where the corner is position 0).
? All other elements will begin with a lowercase letter followed by coordinates. i.e. the hero is represented by h6,8 which means that the hero is at position 6, 8 where the north west corner of the room is position 0,0 (rows,columns).
? letters that can occur in room descriptions will be limited to s(stairs), g (gold),m(magic),h(hero), p(potion), w(weapon) and m(monster). The hero will always be in the first room.
? there will never be more than one door in a wall
? You need do only minimal error checking. The input file used for grading will not contain intentional errors. You should check that the items and heros dont start in the wall and that doors are actually in the wall. adjust items by the minimum number of spaces necessary if there are errors.
? The dimensions of a room include the walls. A 10X16 room has a floor area of 8X14
? 10X16 de4 dw9 ds8 g8,7 m3,4 h6,5 p2,2 is one possible example of a room description Enhancements: 20% You can doseveral enhancements partially, or you can do one or two really thoroughly and get a good mark either way.
? write an algorithm to connect rooms with hallways
? implement combat with monsters
? allow monsters to move randomly within the level
? write an algorithm to generate a new level randomly. When the hero walks over the stairs, go to your new level.
? make an inventory tracking system that can be accessed during game play
? allow the player to use the items that have been picked up
? allow the player to save progress and reload from the save point
? implement different types of monsters that behave differently from one another