🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Game of the General AI Implementation

Started by
17 comments, last by Henry Fernandez 6 years, 3 months ago

Sir can you check my assumption on chance of winning of the piece
Rank private (6 pieces in total) can eliminate 2 spies and ofcourse the flag so my assumption is 9/21 chance of winning is it correct sir ?

Rank 5 star general can eliminate all pieces including for draw 5 star general except for 2 spies so my assumption is 18/21 chance of winning  

sorry im not good in statistics :)

 

 

Advertisement
On 3/19/2018 at 10:38 AM, Henry Fernandez said:

Rank private (6 pieces in total) can eliminate 2 spies and ofcourse the flag so my assumption is 9/21 chance of winning is it correct sir ?

No. If there are 21 possible pieces, and 3 of them can be beaten, then the chance of winning is 3/21.

If you include the chance of a draw, then it maybe doesn't make sense to think in terms of the chance of winning - instead you might have a 'score' for each challenge, and count a draw as the average of a win and a lose. That would make the following:

Private vs 3 pieces it always wins against: 3 * 1 = 3
Private vs 12 pieces it always loses against: 12 * 0 = 0
Private vs 6 pieces it always draws against: 6 * 0.5 = 3
Total 'score' for attacking an unknown piece: 3 + 0 + 3 = 6 (out of a maximum 21, for a hypothetical piece that always win against any of the 21 opposing pieces)

Same equation for general:

General vs 19 pieces it always wins against: 19 * 1 = 19
General vs 2 pieces it always loses against: 2 * 0 = 0
General vs 1 piece it always draws against: 1 * 0.5 = 0.5
Total 'score' for attacking an unknown piece: 19 + 0 + 0.5 = 19.5 (out of a maximum 21)

The higher the score, the more beneficial it is, ignoring the value of the defeated piece or the implications for future turns.

It's easy for your AI to keep track of some information it has learned about pieces that have won a challenge, because the fact that they won restricts what piece it could be. I would keep a 15-bit integer per enemy piece, where each bit represents the possibility of being a particular rank. You can then compute the probability estimates more precisely.

3 hours ago, Kylotan said:

No. If there are 21 possible pieces, and 3 of them can be beaten, then the chance of winning is 3/21.

If you include the chance of a draw, then it maybe doesn't make sense to think in terms of the chance of winning - instead you might have a 'score' for each challenge, and count a draw as the average of a win and a lose. That would make the following:

Private vs 3 pieces it always wins against: 3 * 1 = 3
Private vs 12 pieces it always loses against: 12 * 0 = 0
Private vs 6 pieces it always draws against: 6 * 0.5 = 3
Total 'score' for attacking an unknown piece: 3 + 0 + 3 = 6 (out of a maximum 21, for a hypothetical piece that always win against any of the 21 opposing pieces)

Same equation for general:

General vs 19 pieces it always wins against: 19 * 1 = 19
General vs 2 pieces it always loses against: 2 * 0 = 0
General vs 1 piece it always draws against: 1 * 0.5 = 0.5
Total 'score' for attacking an unknown piece: 19 + 0 + 0.5 = 19.5 (out of a maximum 21)

The higher the score, the more beneficial it is, ignoring the value of the defeated piece or the implications for future turns.

Thank for clarifying my thoughts about probabilities of each pieces sir. :)

 

2 hours ago, alvaro said:

It's easy for your AI to keep track of some information it has learned about pieces that have won a challenge, because the fact that they won restricts what piece it could be. I would keep a 15-bit integer per enemy piece, where each bit represents the possibility of being a particular rank. You can then compute the probability estimates more precisely.

Thank you :) ill try that one

 

Can i apply this simple implemetation as my MCTS in my codes http://mcts.ai/code/java.html?

Please check if my steps of implementation if it is the proper way. I have problem with the speed of my playout. 

e.g I have 15 possible moves

Iterate every moves
     Function 1000 Playout()

           if root node had already state finish the playout and update win/lose of root node

           while root node is leaf iterate until it reached the leaf
                  select using UCT

           expand the leaf node and select from expanded noded using UCT 

           simulate the selected node   *My problem starts here its slowing down my playout

          update the win/lose of the visited nodes

Select the bestNode

I implemented this using http://mcts.ai/code/java.html?

 

 

 

How are you using UCT for a game with hidden information? I'm not even sure this can be done, and it's certainly not straight forward.

im not sure about this id just use the snippet code from here http://mcts.ai/code/java.html?

Capture.PNG

 

This topic is closed to new replies.

Advertisement