Re: [shoes] Math in Shoes
- From:
- Devyn Cairns
- Date:
- 2010-04-23 @ 19:17
http://ruby-doc.org/core/classes/Matrix.html
On Fri, Apr 23, 2010 at 12:03 PM, DeAndrea Monroe <dmonroe4919@gmail.com>wrote:
> Yes a math matrix. To do that, I would just set up an array and itearate
> through the array to get numbers?
>
>
> On Fri, Apr 23, 2010 at 1:25 PM, Steve Klabnik <steve@steveklabnik.com>wrote:
>
>> A matrix as in matrix math? Like an array?
>>
>> You can use regular old Ruby in Shoes, you'd just do the same thing as
>> usual.
>>
>>
>> On Fri, Apr 23, 2010 at 12:43 PM, DeAndrea Monroe <dmonroe4919@gmail.com>wrote:
>>
>>> Hello all, is there a way to consruct a matrix in shoes? If so, how would
>>> I go about doing that?
>>
>>
>>
>
--
~devyn
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-23 @ 20:40
So I used the matrix they have in the website you gave me and it didn't show
anything, all I get is a blank window. I used Matrix[ [25, 93], [-1, 66] ].
What could be the problem?
Re: [shoes] Math in Shoes
- From:
- i5m
- Date:
- 2010-04-23 @ 21:11
Ah, do you mean you want to draw a Matrix in a Shoes window?
On 23 Apr 2010, at 21:40, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
> So I used the matrix they have in the website you gave me and it
> didn't show anything, all I get is a blank window. I used Matrix
> [ [25, 93], [-1, 66] ]. What could be the problem?
>
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-23 @ 21:20
Yes, based on the data that I enter through edit lines.
Re: [shoes] Math in Shoes
- From:
- i5m
- Date:
- 2010-04-23 @ 21:34
Ok, I can't help in detail right now, but have a look at the expert-
othello sample:
http://github.com/shoes/shoes/blob/master/samples/expert-othello.rb
That might be of help with drawing a grid from an "array of an
array" (as I think that is how this sample works).
On 23 Apr 2010, at 22:20, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
> Yes, based on the data that I enter through edit lines.
Re: [shoes] Math in Shoes
- From:
- Devyn Cairns
- Date:
- 2010-04-23 @ 21:39
I would actually use the Matrix class for the data, as it allows math
operations to be done on the entire matrix.
Drawing the grid is as simple as iteration through the Matrix, drawing the
appropriate lines, and then drawing the contents in the spaces.
On Fri, Apr 23, 2010 at 2:34 PM, i5m <i5ivem@googlemail.com> wrote:
> Ok, I can't help in detail right now, but have a look at the expert-
> othello sample:
>
> http://github.com/shoes/shoes/blob/master/samples/expert-othello.rb
>
> That might be of help with drawing a grid from an "array of an
> array" (as I think that is how this sample works).
>
>
> On 23 Apr 2010, at 22:20, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
>
> > Yes, based on the data that I enter through edit lines.
>
--
~devyn
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 18:26
Hello all. I am running my program in shoes but I keep encountering a
problem. the program consists of 3 paras, the first is a set of results, the
second a set of results, and the third has words in it. When I run the
program, the para with the words comes first but I want it to come last, how
do I fix this?
Re: [shoes] Math in Shoes
- From:
- Devyn Cairns
- Date:
- 2010-04-24 @ 18:30
Code?
On Sat, Apr 24, 2010 at 11:26 AM, DeAndrea Monroe <dmonroe4919@gmail.com>wrote:
> Hello all. I am running my program in shoes but I keep encountering a
> problem. the program consists of 3 paras, the first is a set of results, the
> second a set of results, and the third has words in it. When I run the
> program, the para with the words comes first but I want it to come last, how
> do I fix this?
>
>
--
~devyn
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 18:47
I tried to create a repsotiry on github but it wouldn't let me clone it. My
code is:
Shoes.app(:title => "Probability and Statistics", :width => 700, :height
=>700) do
def matrix
@numx = @x.text.to_i
@numy = @y.text.to_i
@det1 = (@numy*@numy)-(@numy*@numy)
@det2 = (@numx*@numy)-(@numy*@numy)
@det3 = (@numy*@numy)-(@numx*@numy)
@det4 = (@numx*@numy)-(@numx*@numy)
@det5 = (@numy*@numx)-(@numy*@numy)
@det6 = (@numy*@numx)-(@numx*@numy)
end
flow(:width => '75%') do
para('Enter two numbers:')
@x = edit_line(:width => 50, height => 25)
@y = edit_line(:width => 50, height => 25)
end
@button = button "Matrices" do
stack(:width => '100%') do
para(" #{@numy} #{@numy} #{@numy}
#{@numy}
#{@numy} #{@numy} #{@numy} #{@numy}
#{@numx} #{@numy} #{@numx} #{@numy}")
para(" #{@numy} #{@numy} #{@numy}
#{@numx}
#{@numx} #{@numy} #{@numx} #{@numx}
#{@numy} #{@numy} #{@numx} #{@numy}")
para(" det1=#{@det1} ")
matrix
end
end
end
Re: [shoes] Math in Shoes
- From:
- i5m
- Date:
- 2010-04-24 @ 18:59
Just use http://gist.github.com/
On 24 Apr 2010, at 19:47, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
> I tried to create a repsotiry on github but it wouldn't let me clone
> it. My code is:
>
>
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 19:08
Ok. I posted my code there. http://gist.github.com/377858
On Sat, Apr 24, 2010 at 2:59 PM, i5m <i5ivem@googlemail.com> wrote:
> Just use http://gist.github.com/
>
> On 24 Apr 2010, at 19:47, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
>
> > I tried to create a repsotiry on github but it wouldn't let me clone
> > it. My code is:
> >
> >
>
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 21:55
Is my code visible to everyone? It can be found at
http://gist.github.com/377858
Re: [shoes] Math in Shoes
- From:
- i5m
- Date:
- 2010-04-24 @ 22:50
Hi,
Yes. Thanks for posting it there. And I will take a look, but it might
not be until Monday that I get a proper chance. Sorry.
On 24 Apr 2010, at 22:55, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
> Is my code visible to everyone? It can be found at http://gist.github.com/377858
Re: [shoes] Math in Shoes
- From:
- Daniel Heath
- Date:
- 2010-04-24 @ 23:32
Is the para with the words in it the one that says 'Enter two numbers'
and has a couple of edit_lines?
On Sun, Apr 25, 2010 at 8:50 AM, i5m <i5ivem@googlemail.com> wrote:
> Hi,
> Yes. Thanks for posting it there. And I will take a look, but it might not
> be until Monday that I get a proper chance. Sorry.
>
> On 24 Apr 2010, at 22:55, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
>
> Is my code visible to everyone? It can be found at
> http://gist.github.com/377858
>
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 23:35
I don't think it is. Have you checked my code out on github?
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 23:39
I just checked the code and that is a para with two edit lines.
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-24 @ 23:41
I believe it is. I was wondering why when I ran the program I keep getting
the text first when I push the button.
Re: [shoes] Math in Shoes
- From:
- Satoshi Asakawa
- Date:
- 2010-04-25 @ 00:11
Hi DeAndrea,
> I was wondering why when I ran the program I keep getting
> the text first when I push the button.
No. Shoes displays the space-lines.
Because at first @numx and @numy are not assigned any numbers. ;-)
So, if you edit the code like this (move matrix before paras):
stack(:width => '100%') do
matrix
para(" #{@numy} ........
para(" #{@numy} ........
para(" det1=#{@det1} ......
end
You'll get your expected output.
Regards,
ashbb
Re: [shoes] Math in Shoes
- From:
- DeAndrea Monroe
- Date:
- 2010-04-25 @ 12:38
Thanks so much. That gave me the exact output I was looking for.
Re: [shoes] Math in Shoes
- From:
- Devyn Cairns
- Date:
- 2010-04-25 @ 16:58
One other tip: for instance vars and global vars you can just write "#@var
#$var" instead of "#{@var} #{$var}"
On Sun, Apr 25, 2010 at 5:38 AM, DeAndrea Monroe <dmonroe4919@gmail.com>wrote:
> Thanks so much. That gave me the exact output I was looking for.
>
>
--
~devyn
Re: [shoes] Math in Shoes
- From:
- Daniel Heath
- Date:
- 2010-04-24 @ 23:38
Yes, I took a look at the gist.
What is the text on the text line?
Is it the 'det1', 'det2' etc line?
On Sun, Apr 25, 2010 at 9:35 AM, DeAndrea Monroe <dmonroe4919@gmail.com> wrote:
> I don't think it is. Have you checked my code out on github?
>
>