Comment
Author: Admin | 2025-04-28
Proposition that the cell in row m and column n contains w where w is either an x or an o or a b (for blank). For example, the term cell(2,3,o) refers to the proposition asserting that there is an o in the cell in row 2 and column 3. We use the unary function constant control to map a player into the proposition that it is that player's turn to mark a cell. For example, the term control(white) refers to the proposition asserting that it is x's turn to mark a cell.There only two types of actions a player can perform - he can mark a cell or he can do nothing (which is what a player does when it is not his turn to mark a cell). The binary function mark together with a row m and a column n designates the action of placing a mark in row m and column n. The mark placed there depends on who does the action. The object constant noop refers to the act of doing nothing.We begin with an enumeration of roles. In this case, there are just two roles, here called x and o role(white) role(black)We can characterize the propositions of the game as shown below. base(cell(M,N,x)) :- index(M) & index(N) base(cell(M,N,o)) :- index(M) & index(N) base(cell(M,N,b)) :- index(M) & index(N) base(control(white)) base(control(black))We can characterize the feasible actions for each role in similar fashio. input(R,mark(M,N)) :- role(R) & index(M) & index(N) input(R, noop) :- role(R) index(1) index(2) index(3)Next, we characterize the initial state by writing all relevant propositions that are true in the initial state. In this case, all cells are blank; and the x player has control. init(cell(1,1,b)) init(cell(1,2,b)) init(cell(1,3,b)) init(cell(2,1,b)) init(cell(2,2,b)) init(cell(2,3,b)) init(cell(3,1,b)) init(cell(3,2,b)) init(cell(3,3,b)) init(control(white))Next, we define legality. A player may mark a cell if that
Add Comment