Question: please help me in c language to make following c file, i have following header files: #ifndef DUNGEON _ INFO _ H #define DUNGEON _

please help me in c language to make following c file, i have following header files:
#ifndef DUNGEON_INFO_H
#define DUNGEON_INFO_H
#include
#include
#include "dungeon_settings.h"
//This is the name we will use for our shared memory.
const char* dungeon_shm_name ="/DungeonMem";
//These are the names for the levers when getting the treasure at the end.
const char* dungeon_lever_one ="/LeverOne";
const char* dungeon_lever_two ="/LeverTwo";
struct Barbarian{
int attack;
};
struct Rogue{
float pick;
};
struct Wizard{
char spell[SPELL_BUFFER_SIZE];
};
struct Barrier{
char spell[SPELL_BUFFER_SIZE +1];
};
struct Enemy{
int health;
};
struct Trap{
char direction;
bool locked;
};
struct Dungeon{
bool running;
pid_t dungeonPID;
struct Barbarian barbarian;
struct Rogue rogue;
struct Wizard wizard;
struct Barrier barrier;
struct Enemy enemy;
struct Trap trap;
char treasure[4];
char spoils[4];
};
//Call this method to begin running the dungeon. Valid pid's must be passed for it to work.
void RunDungeon(pid_t wizard, pid_t rogue, pid_t barbarian);
#endif
#ifndef DUNGEON_SETTINGS_H
#define DUNGEON_SETTINGS_H
#include
//This specifies how many possible characters you can have in your spell buffer. It is a char array. Default: 100
#define SPELL_BUFFER_SIZE (100)
//This is how many rounds the dungeon will play at a minimum. Default: 10
#define NUM_ROUNDS (10)
//This is how long the game will allow the rogue to try to guess the correct number for picking the lock. Default: 4
#define SECONDS_TO_PICK (4)
//This is how many seconds the wizard will have to guess decode the message for the barrier. Default: 2
#define SECONDS_TO_GUESS_BARRIER (2)
//This is how long the barbarian has to attack the monster. Default: 2
#define SECONDS_TO_ATTACK (2)
//This is the tolerance for guessing the rogue's pick. Lower values will be more difficult. Default: 2.5
#define LOCK_THRESHOLD (2.5)
//If true, the barbarian rounds can run. If false, barbarian rounds will not be run. Default: true
#define ALLOW_BARBARIAN true
//If true, the rogue rounds can run. If false, rogue rounds will not be run. Default: true
#define ALLOW_ROGUE true
//If true, the wizard rounds can run. If false, rogue rounds will not be run. Default: true
#define ALLOW_WIZARD true
//How often the dungeon will check the value of the rogue's pick to see if the lock angle was guessed correctly.
//Lower values will increase the rate of checks, but will also put more messages in the terminal. Default: 10000
#define TIME_BETWEEN_ROGUE_TICKS (10000)
//The maximum angle used for the rogue's picking challenge. Default: 100
#define MAX_PICK_ANGLE (100)
//This is the signal that the dungeon will use to communicate with user processes. Default: SIGUSR1
#define DUNGEON_SIGNAL (SIGUSR1)
//This is the signal that the dungeon will use to tell the processes to use their semaphores. Default: SIGUSR2
#define SEMAPHORE_SIGNAL (SIGUSR2)
//The minimum number of times the barbarian will run the dungeon. Default: 2
#define MIN_BARBARIAN_RUNS (2)
//The minimum number of times the rogue will run the dungeon. Default: 2
#define MIN_ROGUE_RUNS (2)
//The minimum number of times the wizard will run the dungeon. Default: 2
#define MIN_WIZARD_RUNS (2)
//How long the treasure door remains open automatically.The information must be copied from inside,
//and then the door allowed to close before this amount of time passes. Default: 10
#define TIME_TREASURE_AVAILABLE (10)
//This is how many points you receive for each correct character when getting the treasure at the end. Default: 4
#define POINTS_PER_TREASURE_CHAR (4)
//This is how many points you get for unblocking the semaphores after getting the treasure at the end. Default: 4
#define POINTS_FOR_POSTING_SEMAPHORES (4)
#endif
Ine Rogue
The Rogue is probably the last class that you should make. The Rogue works as follows:
When the Rogue receives a signal (defined in dungeon_settings. h), the Rogue will attempt to guess a float value to
"pick" a lock. The Trap struct has a char for direction, and a boolean for locked. This puzzle is a little unique. The
Dungeon will wait for a total amount of time defined in dungeon_settings. h as SECONDS_TO_PICK, but will check
the value of the Rogue's current pick position using TIME_BETWEEN_ROGUE_TICKS. Notice that these two values are
quite different, and that is because one of them uses sleep, and the other usleep. I recommend that you follow a
similar example.
Every X microseconds, the Dungeon will check the field pick in the Rogue struct in shared memory, and will change
the direction and locked fields in Trap accordingly. If the Rogue's pick needs to go up, the trap will set direction to
u. If the Rogue's pick needs to go down, the trap will set the direction to d. If the Rogue's pick is in the rig
please help me in c language to make following c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!