librelist archives

« back to archive

marble-solitaire game

marble-solitaire game

From:
J. Kaiden
Date:
2012-04-11 @ 20:42
hey folks -

  another game...  i used to have this marble-solitaire game that i'd play
all the time - you jump and remove marbles, trying to end up with just one
(still not there yet after all these years!)

  anyway, here's my version for red shoes -

screenshot:
https://github.com/lljk/shoes-stuff/blob/master/marble_solitaire_screenshot.png

code: https://github.com/lljk/shoes-stuff/blob/master/marble_solitaire.rb


 @ashbb:  i've tried to get this working with green shoes, but i haven't
had any luck - it seems the `move` method gives me problems.  i added this
code from your rewrite of the breakout and asteroids games:

class Shoes::Widget
  def move x, y
    @ele.move x, y
  end
  def clear
    @ele.clear
  end
end

    ...but still no luck.  any ideas how to make this work?  is it
possible i'm using an outdated green shoes?  i'm using 1.1.354...

  thanks again!

  - j

Re: [shoes] marble-solitaire game

From:
ashbb
Date:
2012-04-12 @ 11:38
Hi J,

Wow, one more new game. Awesome!
I can't port for Green and Purple in time. :-P

BTW, about the difference of Shoes::Widget between Red and Green.

Red Shoes' Widget magic is awesome. But in a trivial case, I become
confused with the behavior. Try out to run the following snippet:

class Hello < Shoes::Widget
  def initialize
    oval left: 100, top: 100, width: 100, height: 100
    para 'hello', left: 130, top: 150
  end
end

Shoes.app do
  nofill
  button('move'){@hello.move 200, 200}
  @hello = hello
end

A black circle moves, but a 'hello' message doesn't.
I know why it doesn't move. But I'm not sure this behavior is spec or bug...

In Green Shoes, Widget object has no methods. So, if you want to do
something to the object, you have to write methods by yourself. ;-)

For example:

class Hello < Shoes::Widget
  def initialize
    @o = oval left: 100, top: 100, width: 100, height: 100
    @p = para 'hello', left: 130, top: 150
  end
  def move x, y
    @o.move x, y
    @p.move x+30, y+50
  end
end

This snippet will work with all Red, Green and Purple. ;-)

ashbb

Re: [shoes] marble-solitaire game

From:
J. Kaiden
Date:
2012-04-12 @ 22:51
hi ash,

  thanks for the advice with green_shoes - i'll try it out and get back to
you...

  as for the red_Shoes snippet that you mentioned, and the confusion you
have about it - i'm confused too!  weird...  i tried a bunch of different
things, and couldn't get the para to move with the oval - very strange
indeed.  whether it's spec or bug i couldn't say, but it certainly is
surprising -

  thanks again for the green_shoes tips!

  Shoes On...

 - j



On Thu, Apr 12, 2012 at 11:38 AM, ashbb <ashbbb@gmail.com> wrote:

> Hi J,
>
> Wow, one more new game. Awesome!
> I can't port for Green and Purple in time. :-P
>
> BTW, about the difference of Shoes::Widget between Red and Green.
>
> Red Shoes' Widget magic is awesome. But in a trivial case, I become
> confused with the behavior. Try out to run the following snippet:
>
> class Hello < Shoes::Widget
>   def initialize
>     oval left: 100, top: 100, width: 100, height: 100
>     para 'hello', left: 130, top: 150
>   end
> end
>
> Shoes.app do
>   nofill
>   button('move'){@hello.move 200, 200}
>   @hello = hello
> end
>
> A black circle moves, but a 'hello' message doesn't.
> I know why it doesn't move. But I'm not sure this behavior is spec or
> bug...
>
> In Green Shoes, Widget object has no methods. So, if you want to do
> something to the object, you have to write methods by yourself. ;-)
>
> For example:
>
> class Hello < Shoes::Widget
>   def initialize
>     @o = oval left: 100, top: 100, width: 100, height: 100
>     @p = para 'hello', left: 130, top: 150
>   end
>   def move x, y
>     @o.move x, y
>     @p.move x+30, y+50
>   end
> end
>
> This snippet will work with all Red, Green and Purple. ;-)
>
> ashbb
>
>

Re: [shoes] marble-solitaire game

From:
ashbb
Date:
2012-04-14 @ 00:48
Hi J,

Now it works with Red, Green and Purple. :)
http://vgoff.posterous.com/shoes-marble-solitaire-78487

ashbb

Re: [shoes] marble-solitaire game

From:
J. Kaiden
Date:
2012-04-14 @ 12:25
hi ashbb -

  awesome!  thanks!

 - j

On Sat, Apr 14, 2012 at 12:48 AM, ashbb <ashbbb@gmail.com> wrote:

> Hi J,
>
> Now it works with Red, Green and Purple. :)
> http://vgoff.posterous.com/shoes-marble-solitaire-78487
>
> ashbb
>