Othello

Dependencies:   mbed

othellomain.h

Committer:
Yuto_K
Date:
2018-09-04
Revision:
0:8c7f841516ab

File content as of revision 0:8c7f841516ab:

#include "player.h"

void Play(RandomAI player1,RandomAI player2,Board board){
    uint8_t put_move;
    while(1){
        SetLEDBoard(board);
        if(GameSet(board))break;
        led_board[15][14].red=255;
        if(board.turn==player1.color){
            led_board[14][14].red=255;
            put_move=player1.PutMove(board);
            board.SetBoard(PutStone(board,put_move/8,put_move%8,player1.color).board);
            if(GetPutCoords(board,player2.color).size()!=0)board.turn=-board.turn;
        }
        SetLEDBoard(board);
        if(GameSet(board))break;
        if(board.turn==player2.color){
            led_board[13][13].red=255;
            put_move=player2.PutMove(board);
            board.SetBoard(PutStone(board,put_move/8,put_move%8,player2.color).board);
            if(GetPutCoords(board,player1.color).size()!=0)board.turn=-board.turn;
        }
    }
    led_board[15][15].red=255;
}