2 Variable switch case

Hi there i have problem with switch case.

example:
we have 6 strings:

  1. Apple
  2. Bean
  3. Weapon
  4. Ship
  5. Pen
  6. Book

How should it work:

apple + bean = applebean

bean + apple = applebean

weapon + ship = weaponship

ship + weapon = weaponship

and next compare level:

apple + weaponship = appleweaponship

weaponship + apple = appleweaponship

and so on…

now i have:

switch(left + right)
		{
			case "applebean":	
				createdItem.renderer.material.mainTexture = textures[0];
			break;
			case "appleweapon":	
				createdItem.renderer.material.mainTexture = textures[1];
			break;
			case "appleship":	
				createdItem.renderer.material.mainTexture = textures[2];
			break;
			case "weaponship":	
				createdItem.renderer.material.mainTexture = textures[3];
			break;
		}

but when i change order i need to add more cases.
In my game i need to have 50 or more strings.
Have someone idea? Maybe should i use Hash?

I see the examples you provided (e.g. apple+weapon=appleweapon) but I don’t see a description of the logic involved. Are the result strings intended to be created by concatenating the input strings based on the order they appear in the list you provided at the outset?

You then provided an example of combining an input string with another resultstring (e.g. apple+weaponship=appleweaponship). In this case, are input strings intended to be checked for composition and given the order weight of the first substring in the composite string? Where, for weaponstring, the order weight would be that of weapon (i.e. 3), and therefore being concatenated after apple?

The logic, if you can lay it out, should help you to determine how to go about comparing strings.

And based on your description, it seems as though you might be able to concatenate an arbitrary number of strings which would result in an arbitrary number of result strings. This would mean you couldn’t create a case statement for every possible outcome.

Hashing might work but you would still want to guarantee consistency in key creation and would also need to find out the upper bounds of your possible concatenations.

All of this is going to go into figuring out how to approach the problem.