X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=qchess%2Fsrc%2Fagent_bishop.py;h=20cb4c0ee213d143f006034b1b6b2dca81ee53d3;hb=1da52d4a75c75ddff22f3a67a2c06875b335e601;hp=14640195f6d5f2aabe0467f4afd3876e1159e715;hpb=3decbfd61b59ee2611700e7fa96368e02f643d4d;p=progcomp2013.git diff --git a/qchess/src/agent_bishop.py b/qchess/src/agent_bishop.py index 1464019..20cb4c0 100644 --- a/qchess/src/agent_bishop.py +++ b/qchess/src/agent_bishop.py @@ -2,10 +2,9 @@ class AgentBishop(AgentRandom): # Inherits from AgentRandom (in qchess) - def __init__(self, name, colour): + def __init__(self, name, colour,value={"pawn" : 1, "bishop" : 3, "knight" : 3, "rook" : 5, "queen" : 9, "king" : 100, "unknown" : 2}): InternalAgent.__init__(self, name, colour) - self.value = {"pawn" : 1, "bishop" : 3, "knight" : 3, "rook" : 5, "queen" : 9, "king" : 100, "unknown" : 4} - + self.value = value self.aggression = 2.0 # Multiplier for scoring due to aggressive actions self.defence = 1.0 # Multiplier for scoring due to defensive actions @@ -47,10 +46,9 @@ class AgentBishop(AgentRandom): # Inherits from AgentRandom (in qchess) # Get total probability that the move is protected - [xx,yy] = [piece.x, piece.y] - [piece.x, piece.y] = [x, y] - self.board.grid[x][y] = piece - self.board.grid[xx][yy] = None + self.board.push_move(piece, x, y) + + defenders = self.board.coverage(x, y, piece.colour, reject_allied = False) d_prob = 0.0 @@ -73,9 +71,8 @@ class AgentBishop(AgentRandom): # Inherits from AgentRandom (in qchess) if (a_prob > 1.0): a_prob = 1.0 - self.board.grid[x][y] = target - self.board.grid[xx][yy] = piece - [piece.x, piece.y] = [xx, yy] + self.board.pop_move() + # Score of the move