Trying to check string against name of array

Welcome to the forum.

Unfortunately your problem is not clearly defined so answering it is not going to be easy. I tried the ‘classic’ version of the pokemon game to help me understand the problem.

So the computer selects a pokemon at random. Then the player guesses a pokemon by typing in its name. The computer then compares the attributes (Type 1, Type 2, Habitat …) of the player’s pokemon against the hidden one and displays the results.

This image shows part of the pokemon game and we can see that the hidden pokemon has the following attributes

  • Type 1 : is not FIRE, WATER or POISON
  • Type 2 : has NONE
  • Evolution Stage : 2
  • Height : between 60 and 160 cm
  • Weight : 8.5 15.5 kg

I have ignored the other attributes but we can see that comparing attributes is a much more complex than simply testing for equality.

Personally I would use object orientated programming but I don’t know if you are confident creating classes and objects so I will stop here for the moment.

The next step is for you to give a more concrete example of the game you are trying to create, the type of attributes / traits being used and so on. Also it would help to know what programming language / Processing mode you are using e.g.

  • Processing Java mode
  • Python
  • p5js
1 Like