Tag Info

New answers tagged

2

First thing is to know the partitions of the number 5 (the team size you want to assembly). There are algorithms to generate the partitions of a number but since the number is small and fixed you don't need to worry about it. The partitions of 5 are: {5}, {4,1}, {3,2}, {3,1,1}, {2,2,1), {2,1,1,1}, and {1,1,1,1,1}. Make 5 lobby lists (L1,L2,L3,L4,L5). One ...


1

Calculate the total rank of all players in a single lobby. Match with other lobby based on that. (+- 1.5 range pretty much) Isn't it as simple as this?


2

Services, not Superclasses These things are not related objects, they are behavioral aspects of game objects that may come and go as the state of the game objects change; think about them as services, not superclasses. They're not well-suited to purely compositional elements either, as the in-game behavior will likely be strongly dependent on the state of ...


2

Let's try to analyse the costs When the move is not valid, pick a new random one. Drawback: The program is now probabilistic; it is very possible that it picks only invalid moves repeatedly, and therefore never finishes executing. is it? Even if you play in a 19x19 board and have only one move left, this gives you a 1/361 chance to pick it and ...


9

Maintain and update the list of possible moves to pick from. Changes to this list will be small per move on average and often localized to where the piece was put.


3

How about using a hybrid approach? First, estimate the number of available valid moves. (Probably based on the percentage of the board that is covered with stones/pegs/pawns.) If the number of available valid moves is large, then it is okay to follow the strategy of trying moves at random until a valid one is found, because it will soon yield a result. ...


4

I think the problem here is that you have not given a clear description of what tasks are to be handled by which classes. I will describe what I think is a good description of what each class should do, then I will give an example of generic code that illustrates the ideas. We will see that the code is less coupled, and so it doesn't really have circular ...



Top 50 recent answers are included