USE MATLAB
Write a program in Matlab that would continuously ask the userfor an input between 1 and 6, which would represent the result ofrolling a die. The program would then generate a random integerbetween 1 and 6 and compare its value to the value entered byuser.
If the user’s die is larger, it should display, “Mahahanap mona ang forever mo. Sana all!”
If the user’s die is smaller, it should display, “Gising nafriend, di ka niya mahal!”
If the results are the same, it should display, “Move on naghorl”.
The program should ask if the user wants to play another game(to be answered by either ‘Y’ or ‘N’). If the user answers ‘Y’, thegame continues. If the user answers ‘N’, the game ends and it willdisplay, “Mabuti naman at natauhan ka na!”.
The program should have a main script named lovedicegame.m andcalls on the following functions:
a. A function readdice.m to prompt the user and read in theinteger input.
b. A function genrandomdice.m to generate a random integerbetween 1 and 6.
c. A function comparedice.m to compare the input and thegenerated integer and display the results.
Sample run:
>> lovedicegame
>> Do you want to play the lovedice game (Y/N)? Y
>> Enter your dice: 5
>> My dice result: 6
>> Gising na friend, di ka niya mahal!
>> Play again (Y/N)? Y
>> Enter your dice: 3
>> My dice result: 1
>> Mahahanap mo na ang forever mo. Sana all!
>> Play again (Y/N)? Y
>> Enter your dice: 2
>> My dice result: 2
>> Move on na ghorl!
>> Play again? N
>> Mabuti naman at natauhan ka na!
Run the game for values:
3?,1,?4?,1?,6