I've got an idea for a hack^H^H^H^H enhancement to the interpreter that I'd
like to try out. If it works, I was thinking of distributing it as a patch.
If somebody wanted to use it, they'd have to d/l the Ruby tarball, apply
the patch, build, and install.
Does this sound like a reasonable approach? Any catches I'm overlooking? Of
course the license would be the same as Ruby's.
What version of Ruby should I use? I suppose the stable 1.8.1, unless of
course 1.8.2 becomes production before I'm done, which is possible.
My plan is to simply check out the v1_8_1 sources from CVS, make the
changes, and make a patch with cvs diff. Is this the right approach?
I've got an idea for a hack^H^H^H^H enhancement to the interpreter that I'd
like to try out. If it works, I was thinking of distributing it as a patch.
If somebody wanted to use it, they'd have to d/l the Ruby tarball, apply
the patch, build, and install.
If the idea is a really good one, send us to merge in.
Does this sound like a reasonable approach? Any catches I'm overlooking? Of
course the license would be the same as Ruby's.
What version of Ruby should I use? I suppose the stable 1.8.1, unless of
course 1.8.2 becomes production before I'm done, which is possible.
CVS HEAD (1.9.0) is a reasonable test bed for new ideas.
matz.
···
In message "Re: Hacking the Ruby interpreter" on Thu, 16 Sep 2004 08:04:50 +0900, Tim Hunter <cyclists@nc.rr.com> writes:
In article <cC32d.7251$n%3.583046@twister.southeast.rr.com>,
I've got an idea for a hack^H^H^H^H enhancement to the interpreter that I'd
like to try out. If it works, I was thinking of distributing it as a patch.
If somebody wanted to use it, they'd have to d/l the Ruby tarball, apply
the patch, build, and install.
Does this sound like a reasonable approach? Any catches I'm overlooking? Of
course the license would be the same as Ruby's.
What version of Ruby should I use? I suppose the stable 1.8.1, unless of
course 1.8.2 becomes production before I'm done, which is possible.
My plan is to simply check out the v1_8_1 sources from CVS, make the
changes, and make a patch with cvs diff. Is this the right approach?
What enhancements are you planning to add? There are a couple of problems
with things like this:
1) Not many people are going to apply the patch. It's a lot more work
than installing a package and it could make your version of Ruby
incompatible with others.
2) You could find that your patch needs to be adjusted everytime a new
version of Ruby comes out. It'll probably be version-specific which again
will limit it's adoption.
If you're trying to do a proof-of-concept with your patch, then perhaps
you should submit an RCR and include your patch with it. Then it might
have a chance at making it into the standard Ruby distirbution.
I've got an idea for a hack^H^H^H^H enhancement to the interpreter that I'd
like to try out. If it works, I was thinking of distributing it as a patch.
It might be possible to implement it in pure Ruby (look at evil.rb).
If somebody wanted to use it, they'd have to d/l the Ruby tarball, apply
the patch, build, and install.
Does this sound like a reasonable approach? Any catches I'm overlooking? Of
course the license would be the same as Ruby's.
What version of Ruby should I use? I suppose the stable 1.8.1, unless of
course 1.8.2 becomes production before I'm done, which is possible.
Better use the CVS stable (ruby_1_8) branch.
My plan is to simply check out the v1_8_1 sources from CVS, make the
changes, and make a patch with cvs diff. Is this the right approach?
Should work.
But don't expect many people to apply your patch...
···
On Thu, Sep 16, 2004 at 08:04:50AM +0900, Tim Hunter wrote:
--
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
If at all possible, implement it as an extension first so people who
want to try it can do so without patching Ruby. Sometimes this is not
possible; other times it is possible but requires weird hacks.
Paul
···
On Thu, Sep 16, 2004 at 08:04:50AM +0900, Tim Hunter wrote:
I've got an idea for a hack^H^H^H^H enhancement to the interpreter that I'd
like to try out. If it works, I was thinking of distributing it as a patch.
If somebody wanted to use it, they'd have to d/l the Ruby tarball, apply
the patch, build, and install.
Reading the recent posts about ant-wars, I thought that, as a nuby, it would be interesting to try to recreate the ant-wars engine. I looked at their code a little, and then started in. I appreciate that James Edward Gray II provided us with his code, but I'll look at it after I've made more progress.
I decided to create 2-d arrays to hold the data for given positions ( hexagonal blocks ). One would hold the amount of food at a position, another would hold the traversability of it, etc. My first attempt failed in a strange way and the point of this email is: why?
Then I read some archived emails from the group and found Matrix mentioned, but a matrix couldn't be changed by assignment. However, it COULD be converted into an array, and so we get:
Then I found another method was mentioned as listed in The Ruby Way:
Method 3
matrix = ( 0..9 ).map { ( 0..9 ).map { 0 } }
and when I use puts with the code as above, it works.
I understand Method 2, I "sort of" understand Method 3, but I don't know why "my" Method 1 doesn't work.
Thanks,
Barry
Reading the recent posts about ant-wars, I thought that, as a nuby, it would be interesting to try to recreate the ant-wars engine. I looked at their code a little, and then started in. I appreciate that James Edward Gray II provided us with his code, but I'll look at it after I've made more progress.
You'll enjoy it, it's a fun project.
I decided to create 2-d arrays to hold the data for given positions ( hexagonal blocks ). One would hold the amount of food at a position, another would hold the traversability of it, etc. My first attempt failed in a strange way and the point of this email is: why?
See inline comments below...
Method 1
cols = 10
empty_row_int = Array.new( cols, 0 )
Here you create an Array object and store a reference to that object in empty_row_int.
And here, you set each row to that same reference you created above. You aren't making a bunch of unique rows, you're reusing the same row over and over again. Change one and you change them all.
To fix it, try creating a new array as you define each row. Remember, Ruby variables just hold references to the actual objects, not the objects themselves.
Hope that helps.
James Edward Gray II
···
On Sep 16, 2004, at 3:09 PM, Barry Sperling wrote:
I suspect method 1 doesn't do what you expect because you create one
single row and then make an array in which every element is that same
row. Try instead:
On Thu, 2004-09-16 at 13:09, Barry Sperling wrote:
Reading the recent posts about ant-wars, I thought that, as a nuby, it
would be interesting to try to recreate the ant-wars engine. I looked
at their code a little, and then started in. I appreciate that James
Edward Gray II provided us with his code, but I'll look at it after I've
made more progress.
I decided to create 2-d arrays to hold the data for given positions (
hexagonal blocks ). One would hold the amount of food at a position,
another would hold the traversability of it, etc. My first attempt
failed in a strange way and the point of this email is: why?
Then I read some archived emails from the group and found Matrix
mentioned, but a matrix couldn't be changed by assignment. However, it
COULD be converted into an array, and so we get:
Then I found another method was mentioned as listed in The Ruby Way:
Method 3
matrix = ( 0..9 ).map { ( 0..9 ).map { 0 } }
and when I use puts with the code as above, it works.
I understand Method 2, I "sort of" understand Method 3, but I don't know
why "my" Method 1 doesn't work.
Thanks,
Barry
Reading the recent posts about ant-wars, I thought that, as a nuby, it would be interesting to try to recreate the ant-wars engine. I looked at their code a little, and then started in. I appreciate that James Edward Gray II provided us with his code, but I'll look at it after I've made more progress.
I decided to create 2-d arrays to hold the data for given positions ( hexagonal blocks ). One would hold the amount of food at a position, another would hold the traversability of it, etc. My first attempt failed in a strange way and the point of this email is: why?
On Fri, 17 Sep 2004 05:09:56 +0900, Barry Sperling <barry@angleinc.com> wrote:
Reading the recent posts about ant-wars, I thought that, as a nuby,
it would be interesting to try to recreate the ant-wars engine. I
looked at their code a little, and then started in. I appreciate
that James Edward Gray II provided us with his code, but I'll look
at it after I've made more progress.
I decided to create 2-d arrays to hold the data for given positions
(hexagonal blocks). One would hold the amount of food at a position,
another would hold the traversability of it, etc. My first attempt
failed in a strange way and the point of this email is: why?