Thx
This is brilliant!!
2008/9/10 Oleg Kobchenko <[EMAIL PROTECTED]>
> The whole thing should be
>
> require 'viewmat'
> F=: readbmp jpath'~user/chess/chess32.bmp'
> C=: ,/(,:~32 32) ];.3 F
> a=: 'JTIWLUHVSGSGSGSGYZYZYZYZZYZYZYZYYZYZYZYZZYZYZYZYAMAMAMAMPBOERCND'
> viewrgb ,/,./"3(_8]\65-~a.i.a){C
>
>
>
>
> ----- Original Message ----
> > From: Björn Helgason <[EMAIL PROTECTED]>
> > To: Programming forum <[email protected]>
> > Sent: Wednesday, September 10, 2008 12:24:25 AM
> > Subject: Re: [Jprogramming] chess pieces
> >
> > Why is view a showing the wrong piece?The rest are ok
> >
> > 2008/9/10 Oleg Kobchenko
> >
> > > You load the chess32.bmp and cut into a list of piece icons.
> > > It should be indexed by piece, color and square color.
> > > Makes sense to superimpose checkered board on pieces.
> > >
> > > Then you assemble the 8x8 board of those indices
> > > replacing with icons and stitch it.
> > >
> > >
> > >
> > >
> > > > From: Björn Helgason
> > > > To: Programming forum
> > > > Sent: Tuesday, September 9, 2008 7:56:02 PM
> > > > Subject: [Jprogramming] chess pieces
> > > >
> > > > I have been meaning to try out the chess pieces for a long time but
> never
> > > > got around to it until now.
> > > >
> > > > http://www.jsoftware.com/jwiki/Scripts/Chess_Generator
> > > > I took the cardgen script and used it as a starting point as
> suggested
> > > and
> > > > tested until I got the chesspieces displayed correctly.
> > > >
> > > > require 'viewmat'
> > > >
> > > > F=: readbmp jpath'~user/chess/chess32.bmp'
> > > > C=: ,/}:"_1 ] 0 1 2 3 4{(,:~32 31) ];.3 F
> > > > T=: 16ba000
> > > >
> > > > maxd =: |:@:([EMAIL PROTECTED]&>) {@;&(>./) {:@$&>
> > > > table =: [: > [: ,&.>/ [: ,.&.>/"1 maxd {.!.T&.> ]
> > > > hand =: (,!.T)&.>/
> > > > NB. stack=: (,.~ 12&{."1)~/
> > > > stack=: (,.~ 1&{."1)~/
> > > > NB. group=: [: (<[EMAIL PROTECTED]&13 > group=: [: (<[EMAIL
> > > > PROTECTED]&1 > shand =:
> > > empty`([: >@hand (~ group)@.([EMAIL PROTECTED])
> > > >
> > > > NB. tabmat =: 3 3 $&, a:&,.
> > > > tabmat =: 8 16 $&, a:&,.
> > > > view =: [:viewrgb [:table [:shand&.> tabmat
> > > > deal =: _2(<\?~)30"_
> > > >
> > > > NB. view deal''
> > > > a=:
> > > >
> > >
> >
> 9;19;8;22;11;20;7;21;18;6;18;6;18;6;18;6;24;25;24;25;24;25;24;25;25;24;25;24;25;24;25;24;24;25;24;25;24;25;24;25;25;24;25;24;25;24;25;24;0;12;0;12;0;12;0;12;15;1;14;4;17;2;13;3
> > > > b=:
> > > >
> > >
> >
> 9;19;8;22;11;20;7;21;18;6;18;6;18;6;18;6;24;25;24;25;24;25;24;25;25;24;25;24;25;24;25;24;24;25;24;25;24;25;24;25;25;24;25;24;25;24;25;24;0;12;0;12;0;12;0;12;15;1
> > > > 1;14;4;17;2;13;3
> > > > view a
> > > > view b
> > > >
> > > > ---------------------------------------
> > > >
> > > > view a gives me a wrong piece
> > > > It gives pawn instead of the knight
> > > > (piece 0 instead of piece 1)
> > > >
> > > > view b gives the knight in the right place but a green line down the
> > > table
> > > > (used 1 1 instead of 1)
> > > >
> > > > I am pretty sure this is not the best solution but it sort of works.
> > > >
> > > > Can someone please explain why view a displays the wrong piece?
> > >
> > >
> > >
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> >
> >
> >
> > --
> > Björn Helgason, Verkfræðingur
> > Fugl&Fiskur ehf,
> > Þerneyjarsundi 23, Hraunborgum
> > Po Box 127,801 Selfoss ,
> > t-póst: [EMAIL PROTECTED]
> > gsm: +3546985532
> > Landslags og skrúðgarðagerð, gröfuþjónusta
> > http://groups.google.com/group/J-Programming
> >
> >
> > Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
> >
> > góður kennari getur stigið á tær án þess að glansinn fari af skónum
> > /|_ .-----------------------------------.
> > ,' .\ / | Með léttri lund verður |
> > ,--' _,' | Dagurinn í dag |
> > / / | Enn betri en gærdagurinn |
> > ( -. | `-----------------------------------'
> > | ) | (\_ _/)
> > (`-. '--.) (='.'=)
> > `. )----' (")_(")
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Þerneyjarsundi 23, Hraunborgum
Po Box 127,801 Selfoss ,
t-póst: [EMAIL PROTECTED]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm