Final answer:
To simulate a Fruit Machine, you can use a combination of variables, iteration, selection, and sequence in your program. The program starts with 1 credit and keeps subtracting 0.2 credits with each play. It generates three random symbols and checks for winning combinations. If two symbols match, the credit is increased by 0.5. If three symbols match, the credit is increased by 1, except if the symbol is 'Bell', in which case the credit is increased by 5. If two or three 'Skull' symbols are rolled, the credit is set to 0 and the game ends.
Step-by-step explanation:
To simulate a Fruit Machine, you can use a combination of variables, iteration, selection, and sequence in your program. Here is a pseudo code example:
START
SET credit = 1
WHILE credit >= 0
IF credit < 0.2
EXIT
END IF
SET credit = credit - 0.2
SET symbol1 = randomSymbol()
SET symbol2 = randomSymbol()
SET symbol3 = randomSymbol()
DISPLAY symbols
IF symbol1 = symbol2 AND symbol2 = symbol3
IF symbol1 = 'Bell'
SET credit = credit + 5
ELSE IF symbol1 = 'Skull'
SET credit = 0
ELSE
SET credit = credit + 1
END IF
ELSE IF symbol1 = symbol2 OR symbol2 = symbol3 OR symbol1 = symbol3
SET credit = credit + 0.5
END IF
END WHILE
END
This pseudo code represents the flow of the Fruit Machine simulation. The program starts with 1 credit and keeps subtracting 0.2 credits with each play. It generates three random symbols and checks for winning combinations. If two symbols match, the credit is increased by 0.5. If three symbols match, the credit is increased by 1, except if the symbol is 'Bell', in which case the credit is increased by 5. If two or three 'Skull' symbols are rolled, the credit is set to 0 and the game ends.