function mancala1()

% 1: most basic idea

% --------- Main Loop to Play the Game -------------
% pn:      Player Names (two string cell array)
% again:   Play Again? (logical)
% b:       Board (twelve integer array of pockets)
% ps:      Player Scores (two integer array)

pn = getPlayerNames();
again = true;
while again
  [b ps it] = setUpGame();
  [ps] = playGame(b, ps, pn, it);
  declareWinner(ps, pn)
  again = anotherGame();
end

% --------- Get Player Names from Input ------------
function player = getPlayerNames()
player{1} = input('Enter first player''s name: ', 's')
player{2} = input('Enter second player''s name: ', 's')
return

% --------- Set up the Initial Board etc. ----------
function [board playerScores it] = setUpGame()
disp('Set up game');
board(1:12) = 4        % four stones in each hole to start
playerScores(1:2) = 0  % zero out the opening scores
it = 1                 % start with player one
return

% --------- Play the Game to its Conclusion (stub) --
function [playerScores] = playGame(board, playerScores, playerNames, it)
disp('Play game');
playerScores = []
return

% --------- Declare the Winner (stub) ---------------
function declareWinner(playerScores, playerNames)
disp('Declare winner');
return

% --------- Another Game request --------------------
function another = anotherGame()
another = input('Another game (1 if yes, 0 if no)? ');
return
 
