I try to made aq very simple MahJongg with this info links http://en.wikipedia.org/wiki/Mahjong_solitaire http://home.halden.net/vkp/vkp/ For made the grid I made grid := OrderedCollection new. madeThisRowFor: aInteger at: aPoint | topRow square newSquare | topRow := AlignmentMorph newRow. topRow position: aPoint. topRow openInWorld. square := Morph new. square color: Color transparent; borderWidth: 2; extent: 45 @ 54; borderColor: Color blue. 1 to: aInteger do: [:c | newSquare := square copy. topRow addMorph: newSquare. grid add: topRow submorphs last center]. Don’t work as grid is populated by same values . Example: self madeThisRowFor: 12 at: 0 @ 0. Grid an OrderedCollection(22@27 22@27 22@27 22@27 22@27 22@27 22@27 22@27 22@27 22@27 22@27 22@27) But if I put self half before grid add: topRow submorphs last center I got an OrderedCollection(24@29 69@29 114@29 etc ) Really odd, some could explain ? Edgar _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
--- On Thu, 5/7/09, Edgar J. De Cleene <[hidden email]> wrote: > From: Edgar J. De Cleene <[hidden email]> > Subject: [Newbies] [Q] What is wrong here ? > To: "A friendly place to get answers to even the most basic questions about Squeak." <[hidden email]> > Date: Thursday, May 7, 2009, 9:23 AM > Folks: > I try to made aq very simple MahJongg with this info links > http://en.wikipedia.org/wiki/Mahjong_solitaire > http://home.halden.net/vkp/vkp/ > > For made the grid I made > > grid := OrderedCollection new. > > madeThisRowFor: aInteger at: aPoint > | topRow square newSquare | > topRow := AlignmentMorph newRow. > topRow position: aPoint. > topRow openInWorld. > square := Morph new. > square color: Color transparent; > borderWidth: 2; > extent: 45 @ 54; > borderColor: Color blue. > 1 > to: aInteger > do: [:c | > newSquare := square copy. > topRow addMorph: newSquare. > grid add: topRow submorphs last center]. > > > DonĀ¹t work as grid is populated by same values . > Example: > self madeThisRowFor: 12 at: 0 @ 0. > > Grid an OrderedCollection(22@27 22@27 22@27 22@27 22@27 > 22@27 22@27 22@27 > 22@27 22@27 22@27 22@27) > > But if I put self half before > > grid add: topRow submorphs last center > > I got > > an OrderedCollection(24@29 69@29 114@29 etc ) > > Really odd, some could explain ? You have left out some important details. There seems to be a class involved. What is it. Is grid an ivar of that class? ==== Also, Why not do a mockup in a workspace first? Why not just create the row then collect the centers from the submorphs? e.g. squarePrototype := what you said for square. topRow := what you said for topRow anInteger timesDo: [ topRow addMorph: squarePrototype copy ] . then make grid := topRow submorphs collect: [ :each | each center ] . Yours in curiosity and service, -Jerome Peace _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Edgar J. De Cleene
--- On Sat, 5/9/09, Edgar J. De Cleene <[hidden email]> wrote: > From: Edgar J. De Cleene <[hidden email]> > Subject: Re: [Newbies] [Q] What is wrong here ? > To: [hidden email] > Date: Saturday, May 9, 2009, 3:24 PM > On 5/8/09 10:19 PM, "Jerome Peace" > <[hidden email]> wrote: > > > You have left out some important details. > > There seems to be a class involved. > > What is it. Is grid an ivar of that class? > > > > ==== > > Also, Why not do a mockup in a workspace first? > > Why not just create the row then collect the centers > from the submorphs? > > > > e.g. > > squarePrototype := what you said for square. > > > > topRow := what you said for topRow > > > > anInteger timesDo: [ topRow addMorph: squarePrototype > copy ] . > > > > then make > > > > grid := topRow submorphs collect: [ :each | each > center ] . > > > > > > Yours in curiosity and service, -Jerome Peace > Old friend: > > Yes, grid is a ivar of a class. > Yes, of course was the first very unoptimized sketch and of > course usually I > do mockups in a workspace first, and sometimes I use the > beautiful of > Smalltalk and start to see what is going on with classes > and objects. > > But you miss the point I ask.... > > Why you have the wrong values if don't put a self halt > ? > > I say is very , very odd some give a value without a self > halt and other > value if you put the self halt. I can't reproduce the problem. Can you isolate the relevant code and upload? Or produce an specific example of the problem that can be reproduced? The reason I didn't look into the question you asked was that there was not enough info. The first rule of trouble shooting is first hand information. No sense trying to guess the answer. Squeak has too many bugs. I'm as likly to find one of the other ones as yours. > By the way , I polishing the still rough corners for having > a Squeak version > of MahJongg for sharing with all squeakers and get > feedback. > > Stay tuned and always a pleasure. > Yours > Edgar _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |