# Is a rational game playing agent still rational when not staying off terminal states when it looses in all child states?

I am working on a programming assignment to implement a Minimax algorithm and heuristic for the game Lines of Action.

The rules are pretty simple, each player alternates turns moving a single piece. A piece may move in rows, columns, and diagonals and it must move the exact number of spaces that there are other pieces in that "line of action". A piece may capture an opponent piece, jump its own pieces, but it may not jump other players pieces. The game is over when all of a players pieces form a connected graph.

I have been debugging my implementation of Minimax and have found a case in which an "odd" move is made. For debugging I have been using a smaller board than the usual 8x8 version used in normal play. In the image below you can see the pieces for the Black (human/myself) and Red (computer/minimax) players across and entire game on a 4x4 board, the final board showing the "odd" move made by Red.

As you can see the "odd" move is that Red opts to end the game by taking Black's piece which results in Black's win, Red seems to cause its own demise. But this doesn't seem so bad. If you look at Red's possible moves after Black's starting move below

There is no possible way that Red can stop Black (a totally rational player; myself) from winning after its move. Can this move by Red still be seen as a rational move?

(Seeing that I wrote the minimax implementation) I want to think that in a no win situation any move by a rational agent can be seen to be rational if there is no possible way to win. Though in the case above Red could still increase its utility before its demise. For instance, Red could try to block one of Black's moves

If an agent can still gain utility in the short run but always loose in the long run, must it to still be rational?

• Those alternative moves don't gain any utility. – user2357112 supports Monica Feb 12 '17 at 6:17
• What definition of "rational" are you using? Is the question you really want answered "Does this count as rational", or do you perhaps want to know "How do I build an AI where the computer doesn't do this, but gives itself the best chance of winning in case their human opponent later makes a mistake?" – D.W. Feb 12 '17 at 16:05