69.8k views
0 votes
One subtask in the game is to roll the dice. explain why is roll the dice an abstraction.

User MarcGuay
by
4.2k points

2 Answers

5 votes

Answer:

An abstraction is about removing unnecessary pieces of information. Here the dice roll will just give the result of the "roll" without any of the actual dice information.

Step-by-step explanation:

In a real situation you pick up a dice, roll it to then see it rolling around as the number changes until it stops and you get a final result. We remove the middle part and leave only the output.

Also on a side note the previous answer gives a strange description of why a game is made up of sub tasks.

You make a game, and many programs, out of sub tasks as it provides easy decomposition (breaking down a task into small parts). It has nothing at all to do with the end user but rather it is a way of making the program easier to create, debug and maintain. It is easier to do this because you avoid repeating code, it is easier to find errors as you probably know roughly where the error is and it also allow easy changes to sections as the are in their own sub programs.

User Jbosch
by
4.3k points
2 votes

Answer:

A game is built from a combination of sub-tasks in order to provide the best experience to the user and make sure that the interface is comprises of only the results of the ongoing sub-tasks to provide a higher degree of data abstraction.

Data abstraction refers to the process of representing the essential information without including the background details. Rolling a dice is preferred to be a sub-task so that the user only gets to know about the result of the roll and does not have to wait for or anticipate the result. Moreover, a game may consist of n number of sub-tasks so it is not a good idea to include them in the main framework and are preferred to be abstracted.

User Maliek
by
4.3k points