Hello community,

I'm working on a project an am in need of a little help, so I hope I'll get some hints here.

This is about a game, but I thought it fits this category best. So I do a board game with cards (which is completed) and now the ai needs to become smart. All this is done, but where I'm having trouble is finding permutations of my cards. Here's what we've got:

- cards are numbered from 0 to 6, so I work with ints (or Strings, whatever is best)

- we are given 9 cards --> so there could be something like 111534123

- we want to pick 5 cards (their order is the important thing here)

- we want to try out all permutations an find the best (this is done)

- it should be as fast a possible (getting all 9-int-permutation is not fast because of the trying part)

What I have so far is a method that finds all permutations of 5 (or 9) given ints _without_ repeating identical numbers (e.g. 11354 only appears once, not twice).

So my idea was to pick 5 out of these 9 ints and then permutate them with my algorithm.

What I need help with is:

- How do I pick 5 of these 9 cards to then permutate them? Without repetition of course.

- Is my idea nonsense and there is a way to combine these two steps or am I thinking in the complete wrong direction?

Furthermore, there are combinations that are deadly and we do not want to permutate them. Say we have 12345, and the testing shows card 2 kills us, so we don't want to test 12435,... because they're all deadly. (This is not the main question, I don't think this can be done without code.)

So, I hope I made myself clear, I apologize if not, and hope someone can give me some kind of idea. A hint would be enough, pseudo if it makes it clearer.

Thanks a lot,

Nahara