function latrunculi()

% most basic idea
% set up the game
% play the game 
% get the play

global board score it marker player
disp('Welcome to Latrunculi, a game from classic Rome!');
player = getPlayerNames();
another = true;
while another
  setUpGame();
  playGame();
  another = anotherGame();
end
return

function player = getPlayerNames()
player{1} = input('Enter first player''s name: ', 's');
player{2} = input('Enter second player''s name: ', 's');
return

function setUpGame()
global board score it marker
disp('Set up game');
marker = 'bwBW';
board(1:8, 1:12) = ' ';
board(1,:) = marker(2);
board(2,6) = marker(4);
board(7,7) = marker(3);
board(8,:) = marker(1);
board = char(board);
score(1:2) = 0;
it = 1
return

function playGame()
global board score it marker player
disp('Play game');
alive = true;
while alive
  displayBoard()
  play = getPlay()
  switch play
    case 'Q'
      alive = false
    case 'H'
      makeHint()
    otherwise
      makePlay(play)
      checkCapture(play)
      alive = checkBlock()
      it = 3 - it;
  end
end
declareWin()
return

function displayBoard()
disp('Display Board')
return

function play = getPlay()
global player it marker
disp([player{it} ', your turn (q - quit, h - hint, cr-cr - from-to)'])
fprintf('(You play %c) ', marker(it));
play = upper(input(': ','s'))
while ~validPlay(play)
  displayBoard()
  disp('Whoops, not valid! Choose ''q'', ''h'', or col row - col row')
  disp('as in C4-C6')
  play = upper(input('Play? ','s'))
end
return

function valid = validPlay(play)
disp('Valid Play?')
valid = true
return

function makeHint()
disp('Make a Hint')
return

function makePlay(play)
disp('Make a Play')
return

function checkCapture(play)
disp('Check for a Capture')
return

function alive = checkBlock()
disp('Check for Blocking')
alive = true;
return

function declareWin()
disp('Declare Winner')
return

function another = anotherGame()
another = strcmpi(input('Another game (y or n)? ','s'), 'Y');
return
 
