No BSD License  

Highlights from
cardplot.m

4.5

4.5 | 2 ratings Rate this file 1 Download (last 30 days) File Size: 30.65 KB File ID: #3811
image thumbnail

cardplot.m

by Rasmus Anthin

 

05 Aug 2003 (Updated 05 Jul 2005)

Draw/update/view cards, plot board or change mouse ptr. Hopefully useful when creating card games.

| Watch this File

File Information
Description

Rev 2005-06-16
Rev 2005-04-29.
Rev 2003-08-12.

To simplify the developement of card games (IMHO), you can instead use the card class provided by the Playing Cards Toolbox.

condensed help:
%%%%%%%%%% snip %%%%%%%%

 CARDPLOT Plot playing cards for card games.
    [H,X1,Y1] = CARDPLOT(X0,Y0,CSIZE,VALUE,SUIT)
    draws a card.
 
    CARDPLOT(H,X0,Y0,VALUE,SUIT)
    changes the card with handles in vector H.
 
    BORDER = CARDPLOT(X0,Y0,CSIZE) returns the border of a card at (X0,Y0).

    [VALUE,SUIT] = CARDPLOT(H)
    shows VALUE and SUIT for a card given by the handle vector H.
 
    CARDPLOT(VALUE,SUIT)
    changes the mouse pointer over the current figure (GCF)
    to look like a playing card of value VALUE and suit SUIT.
    Convenient for moving cards with the mouse (see demo).
 
    CARDPLOT(HFIG,VALUE,SUIT)
    same as above but for the specified figure handle HFIG.
 
    CARDPLOT(DIM,COLOR)
    creates a board with color COLOR with dimensions DIM on
    the current axes (GCA).
 
    CARDPLOT DEMO
    shows a demonstration on how to use this application.
 
%%%%%%%%%% snip %%%%%%%%

Don't forget to run "CARDPLOT DEMO" first to see how cardplot can be used!

This function is created using Matlab 5.1.
More stuff can be downloaded from:
http://www.etek.chalmers.se/~e8rasmus/eng/matlab_programs.html

Acknowledgements
This submission has inspired the following:
Blackjack, blackjack.m, Magic Cards
MATLAB release MATLAB 5.2 (R10)
Other requirements Card fonts might look slightly misaligned in Unix. Some tweaking with the code might be needed in such cases.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
15 Aug 2003 Darius Kazemi

I've been developing a poker library for the past few months. I downloaded this m-file and plunked it down in my display function, which was previously text-based. Now my poker game is graphically appealing! An excellent library for anyone doing card-based simulations or games.

12 Dec 2003 Fred Smith

Cool, just what I wanted.

Please login to add a comment or rating.
Updates
11 Aug 2003

The latter version could only create cards. But in this version you can change the value and suit of any card given its handle. It is also possible to change the mouse pointer so you can get the look of moving a card. Adjusted font alignments too.

13 Aug 2003

I have fixed a bug/hole in the program: VALUE='' (face down) could not be used as an input argument.
This new update also features the possibility to easily draw a nice game board.

02 May 2005

In Matlab 7.0.1 (R14), cardplot causes an very weird error msg: "i" was previously used as a function, ...
It only uses i as the imaginary number. However, cardplot now works in R14 anyways.

02 May 2005

In Matlab 7.0.1 (R14), cardplot causes an very weird error msg: "i" was previously used as a function, ...
It only uses i as the imaginary number. However, cardplot now works in R14 anyways.

05 Jul 2005

Further bugfixes. Can now also plot joker cards (wild cards).

Tag Activity for this File
Tag Applied By Date/Time
games Rasmus Anthin 22 Oct 2008 07:05:54
playing cards Rasmus Anthin 22 Oct 2008 07:05:54
clubs Rasmus Anthin 22 Oct 2008 07:05:54
spades Rasmus Anthin 22 Oct 2008 07:05:54
hearts Rasmus Anthin 22 Oct 2008 07:05:54
diamonds Rasmus Anthin 22 Oct 2008 07:05:54
suit Rasmus Anthin 22 Oct 2008 07:05:54
card games Rasmus Anthin 22 Oct 2008 07:05:54

Contact us at files@mathworks.com