First of all Devo colocar o mesmo id ?
: no. The id is used to identify your html elements on the page when you need to manipulate them through javascript for example, and therefore should be unique for each element of the page.
Your javascript function has only one detail that is preventing it from working. You switched document t by r. It would look like this:
function minhaFuncao(id){
var valor = document.getElementById(id).value();
}
I believe that only validation of the value of the button is missing, according to the rules of your game.
On HTML, an example of how to make the button call the function passing the id itself would be as follows:
<button name="botao1" type="button" value="valorDoBotao1" onclick="minhaFuncao(this.id)">botão 1</button>