RPG dices

Report a typo

The tabletop role-playing games usually use multiple dice with various number of faces. Most often the RPG dice have 4, 6, 8, 12 and 20 sides.

Let’s consider an RPG game where all decisions are made by throwing 2 dice with different number of faces. Create the rpgDices function that gets as arguments the number of the faces of 2 dice and returns the sum of the result of rolling both of them.

Write a program in Kotlin
import kotlin.random.Random

fun rpgDices(dice1: Int, dice2: Int): Int {
// write your code here

return sumOfDices
}
___

Create a free account to access the full topic