Super Trunfo

3 respostas
java
Deadpool

Tenho como trabalho da faculdade recriar o jogo Super Trunfo todo em um código em Java. Porém continuam dando erros nas parte de iniciar o jogo e na de definir um vencedor.

public void comecar_jogo(){
            int count=0;
    while (!this.fimdojogo()){
                  this.cartasjogadas.add(this.jogadores.get(0).pegar_carta());
      this.cartasjogadas.add(this.jogadores.get(1).pegar_carta());
                  if (count==0){
                    this.Atributo_escolhido = this.jogadores.get(0).escolher_atributo();
                  }
                  else{
                    this.ganhador_escolhendoatributo();
                  }                                   
      this.definirganhador();
      this.jogadorsemcartas();
      this.resultado();
      interacao.limparconsole();
    }
      
  }

  public void definirganhador(){
    Card cartaganhadora=this.cartasjogadas.get(0).cartaganhadora(this.cartasjogadas, this.Atributo_escolhido);
    if (cartaganhadora == null){
      System.out.println("Sem ganhador dessa vez!!!");
    } else {
      for(int i = 0; i < this.jogadores.size(); i++){
        if (this.jogadores.get(i).cartasjogadas == cartaganhadora){
          System.out.println("Jogador ganhador da rodada:>>>" + this.jogadores.get(i).Nome);
          for(Card elemento: this.cartasjogadas){
            this.jogadores.get(i).cards.add(elemento);
          }
          this.cartasjogadas.clear();
        }
      }
    }
  }

3 Respostas

Lucas_Camara

Quais erros?

Deadpool

4 errors

Main.java: error: int cannot be dereferenced

if (this.jogadores.get(i.ganhou_a_rodada)){

^

Main.java: error: cannot find symbol

while (!this.fimdojogo()){

^

symbol: method fimdojogo()
Main.java: error: cannot find symbol

Card cartaganhadora=this.cartasjogadas.get(0).cartaganhadora(this.cartasjogadas, this.Atributo_escolhido);

^

symbol: method cartaganhadora(ArrayList,int)

location: class Card

Main.java: error: cannot find symbol
if (this.jogadores.get(i).cartasjogadas == cartaganhadora){
^
symbol: variable cartasjogadas
location: class jogador

Lucas_Camara

Main.java: error: cannot find symbol
while (!this.fimdojogo()){

O método fimdojogo existe?

Main.java: error: int cannot be dereferenced
if (this.jogadores.get(i.ganhou_a_rodada)){

Essa variável i é do tipo int? Se for, tah errado

Main.java: error: cannot find symbol
Card cartaganhadora=this.cartasjogadas.get(0).cartaganhadora(this.cartasjogadas, this.Atributo_escolhido);

O Atributo_escolhido existe no código


Parece que seu código está todo fora de padrão e ordem. Você fez esse código ou pegou ele em algum lugar e está adaptando?

Criado 26 de abril de 2019
Ultima resposta 26 de abr. de 2019
Respostas 3
Participantes 2