To represent the “logic” of our game we are going to use the following variables
ID: 3762494 • Letter: T
Question
To represent the “logic” of our game we are going to use the following variables:
- An integer array ‘a’, representing the integer number we are working with at the moment (e.g., if the number is 144556, then our array is going to contain [1,4,4,5,5,6]). - An integer pointer ‘p’, representing the index of the array we are pointing at (e.g., if ‘a’ has 6 elements, the pointer can be pointing at a[0], a[1], a[2], a[3], a[4] and a[5]). - An integer ‘nm’, representing the amount of commands already applied to convert the provided integer number into a palindrome one. The minimal set of supported commands is: o Command ‘a’: It moves the pointer one position to the left on the array (in case the current value of the pointer is not in the very left border). o Command ‘d’: It moves the marker one position to the right on the array (in case the current value of the pointer is not in the very right border). o Command ‘w’: It increases the digit placed at the position of the array the pointer is pointing at (in case this number is smaller than 9). o Command ‘x’:
It decreases the digit placed at the position of the array the pointer is pointing at (in case this number is bigger than 0). ------
And these are the functions i need to implement
#include
#include
#include
#include
"visible.h" //-------------------------------------------------- // is_pal //--------------------------------------------------
int is_pal(int a[]);
//-------------------------------------------------- // ask_for_command //--------------------------------------------------
char ask_for_command();
//-------------------------------------------------- // process_movement //--------------------------------------------------
void process_movement(int a[], int** p, int* num_mov, char c);
//-------------------------------------------------- // print_status //--------------------------------------------------
void print_status(int a[], int* p, int num_mov);
//-------------------------------------------------- // user_game_palindrome //--------------------------------------------------
void user_game_palindrome(int pal_num);
Language is C
Explanation / Answer
-->Game.java
-->Player.java
-->Human.java
-->Computer.java
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.