Scripts/Cards Generator
< Scripts
Jump to navigation
Jump to search
This script [currently missing] generates a deck of cards as a graphical bitmap suitable for visualizing card layouts. The deck contains 52 cards, a joker, two backs and a blank.
Features
- are arranged by ascending value as used in some games
- card dimension 28×40 (width, height) fits on a PocketPC screen
- picture layout allows partially covered stacking
- the bitmap above is suitable for loading "as is" with readbmp
- cards can be extracted as matrices and composed in a layout
The bitmap file
You need to have the file with the card images before using the cards in other utilities.
The easiest way is to download it from here
- right-click on the image above
- select "Save Picture As ..." or similar menu item
- choose location j\user\cards\cards28x40.png
[This part does not work]
You can create a bitmap from the generator as shown below, however the image on this page was generated with system font configuration to ensure best quality.
f_run '' NB. show the generated cards in a form f_save '' NB. save to user/cards/cards28x40.bmp
Bridge
Here is an example of using the generated cards to lay out a table of bridge.
Generated with view deal'' from the script below.
require 'viewmat' F=: readpng jpath'~user/cards/cards28x40.png' C=: ,/}:"_1 ] 0 3 2 1{(,:~40 28) ];.3 F T=: 16ba000 maxd =: |:@:({.@$&>) {@;&(>./) {:@$&> table =: [: > [: ,&.>/ [: ,.&.>/"1 maxd {.!.T&.> ] hand =: (,!.T)&.>/ stack=: (,.~ 12&{."1)~/ group=: [: (<.@%&13 </. ]) /:~ shand =: empty`([: >@hand (<C) stack@:{&.>~ group)@.(*@#) tabmat =: 3 3 $&, a:&,. view =: [:viewrgb [:table [:shand&.> tabmat deal =: _13(<\?~)52"_
Contributed by Oleg Kobchenko