Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Back Ground Info: IrmaMoves.h : #include IrmaMoves.h typedef struct Move { Irma irma; // an instance of Irma L Location from_loc; // location where Irma

Back Ground Info:

IrmaMoves.h :

#include "IrmaMoves.h"

typedef struct Move {

Irma irma; // an instance of Irma

L Location from_loc; // location where Irma is moving from

Location current_loc; // location where Irma is passing over

Location to_loc; // location where Irma is moving to

} Move;

typedef struct Location {

char col; // the square's column ('a' through 'h')

int row; // the square's row (0 through 7)

} Location;

typedef struct Irma {

int ws; // wind speed (MPH)

int wg; // wind gusts (MPH)

} Irma;

IrmaMoves.c:

#include #include #include #include "IrmaMoves.h"

char **createMapBoard(void){ char **board = malloc(8*sizeof(char *)); //dynamically allocate memory for rows for(int i = 0 ; i < 8 ; i++) //dynamically allocate memory for indiviual elements board[i] = malloc( 8*sizeof(char) ); board[0][0] = 'F'; //initialize the array with the map layout board[0][1] = 'F'; board[0][2] = ' '; board[0][3] = ' '; board[0][4] = ' '; board[0][5] = ' '; board[0][6] = ' '; board[0][7] = ' '; board[1][0] = ' '; board[1][1] = 'F'; board[1][2] = ' '; board[1][3] = ' '; board[1][4] = ' '; board[1][5] = ' '; board[1][6] = ' '; board[1][7] = ' '; board[2][0] = ' '; board[2][1] = 'F'; board[2][2] = 'F'; board[2][3] = ' '; board[2][4] = ' '; board[2][5] = ' '; board[2][6] = ' '; board[2][7] = ' '; board[3][0] = ' '; board[3][1] = ' '; board[3][2] = 'F'; board[3][3] = ' '; board[3][4] = ' '; board[3][5] = ' '; board[3][6] = ' '; board[3][7] = ' '; board[4][0] = ' '; board[4][1] = ' '; board[4][2] = 'K'; board[4][3] = ' '; board[4][4] = ' '; board[4][5] = ' '; board[4][6] = ' '; board[4][7] = ' '; board[5][0] = 'C'; board[5][1] = ' '; board[5][2] = ' '; board[5][3] = 'B'; board[5][4] = ' '; board[5][5] = ' '; board[5][6] = ' '; board[5][7] = ' '; board[6][0] = ' '; board[6][1] = 'C'; board[6][2] = 'C'; board[6][3] = ' '; board[6][4] = 'D'; board[6][5] = ' '; board[6][6] = ' '; board[6][7] = ' '; board[7][0] = ' '; board[7][1] = ' '; board[7][2] = 'C'; board[7][3] = ' '; board[7][4] = ' '; board[7][5] = 'D'; board[7][6] = 'D'; board[7][7] = ' '; return board; };

char **destroyMapBoard(char **board){ //frees up the memory allocated to the board free(board); return NULL; };

void printMapBoard(char **board){ //printing the map in the specified format printf("======== "); for (int i = 0; i < 8; i++){ for (int j = 0; j < 8; j++){ printf("%c",board[i][j]);} printf(" ");} printf("========"); printf(" "); printf(" "); };

Function Help:

1) double difficultyRating(void); Output: This function should not print anything to the screen. Return Value: A double indicating how difficult you found this assignment on a scale of 1.0 (ridiculously easy) through 5.0 (insanely difficult). 2) double hoursSpent(void); Output: This function should not print anything to the screen. Return Value: An estimate (greater than zero) of the number of hours you spent on this assignment. Above is the Header file for IrmaMoves and the beginning of IrmaMoves.c. I bolded the functions that I am unsure of how to do.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

Is this investment worthwhile? Why or why not?

Answered: 1 week ago