historyofgamestates = {};
gamestate = initializegamestate ();
gamestate = makeamove (gamestate、移动);
historyofgamestate (loopcounter) = gamestate;
Loopcounter = Loopcounter +1;
wincounter = wincounter + (0,1,0);
wincounter = wincounter + [0, 0, 1];
wincounter = wincounter + (1,0,0);
historyofgamestates{游戏}= historyofgamestate;
保存(“game1.mat”,“historyofgamestate”)
如果长度(row) ~= 1 &&长度(col) ~= 1
长方形(“位置”,行- 0.8,(col - 0.2), 0.6, 0.6),“弯曲”[1])
绘图([第0.8行第0.2行],-(第0.2列)-(第0.8列)],“k”)
情节([- 0.8行- 0.2],[- (col - 0.8) (col - 0.2)],“k”)
情节([0 3]- [2 2],“k”,“线宽”, 2)
绘图([11],-[03],“k”,“线宽”, 2)
图(2 [2],[0 3),“k”,“线宽”, 2)
功能gamestate = makeamove (gamestate移动)
如果长度(row) ~= 1 &&长度(col) ~= 1
gamestate。董事会= gamestate。板+ * gamestate.turn移动;
gamestate。把= gamestate.turn * 1;
checkfor=[sum(gamestate.board,1),sum(gamestate.board,2)”,gamestate.board(1,1)+gamestate.board(2,2)+gamestate.board(3,3),gamestate.board(1,3)+gamestate.board(2,2)+gamestate.board(3,1)];
功能移动= player1 (gamestate)
功能移动= player2 (gamestate)