from
Spider Solitare
by Madison Welch
Just like Microsoft Spider Solitare
|
| matlab_spider_solitare_deal
|
% Function: matlab_spider_solitare_deal
% Created by Madison Welch Jan 27, 2007
% Function: Deals a set of cards onto the spider solitare board from the
% unrevealed, undistributed part of the deck
% Called by: Button Down Function of cards set aside when the deck is
% initially dealed
%
% global variables:
% game_board - keeps track of where the cards are placed
% deck - the unrevealed, undistributed cards that have not been placed on the game board
% and are still in the deck
%
function matlab_spider_solitare_deal
global game_board deck
h = get(gco,'UserData');
for i = 1:10
new_h = cardplot(i-0.85,4-(length(game_board(i).number)+1)*0.2,1,deck(i).number(end),char(deck(i).suit(end)));
game_board(i).number(end +1) = deck(i).number(end);
game_board(i).suit(end +1) = deck(i).suit(end);
game_board(i).face_up(end +1) = true;
game_board(i).handles(end+1) = {new_h};
set(new_h,'UserData',new_h);
set(new_h,'ButtonDownFcn',['matlab_spider_solitare_move_card(',num2str(i),',',num2str(length(game_board(i).number)),')']);
deck(i).number(end) = [];
deck(i).suit(end) = [];
end
delete(h);
|
|
Contact us at files@mathworks.com