Question

i'm trying to develop Pentago-game in c#.

right now i'm having 2 players mode which working just fine.

the problem is, that i want One player mode (against computer), but unfortunately, all implements of minimax / negamax are for one thing calculated for each "Move" (placing marble, moving game-piece).

butin Pentago, every player need to do two things (place marble, and rotate one of the inner-boards)

I didn't figure out how to implement both rotate part & placing the marble, and i would love someone to guide me with this.

if you're not familiar with the game, here's a link to the game.

if anyone want's, i can upload my code somewhere if that's relevant.

thank you very much in advance

Was it helpful?

Solution

If a single legal moves consists of two sub-moves, then your "move" for game algorithm purposes is simply a tuple where the first item is the marble placement and the second item is the board rotation e.g.:

var marbleMove = new MarbleMove(fromRow, fromCol, toRow, toCol);
var boardRotation = new BoardRotation(subBoard, rotationDirection);
var move = new Tuple<MarblMove, BoardRotation>(marbleMove, boardRotation);

Typically a game playing algorithm will require you to enumerate all possible moves for a given position. In this case, you must enumerate all possible pairs of sub-moves. With this list in hand you can move on to using standing computer game playing approaches.

OTHER TIPS

Rick suggested tuples above, but you might want to actually just have each player make two independent moves, so it remains their turn twice in a row. This can make move ordering easier, but may complicate your search algorithm, depending on which one you are using.

In an algorithm like UCT (which is likely to outperform minimax for simple implementations) breaking into two moves can be more efficient because the algorithm can first figure out what moves placements are good, and then figure out what rotation is best. (Googling UCT doesn't give much. The original research paper isn't very insightful, but this page might be better: http://senseis.xmp.net/?UCT)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top