[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Smart Way Thinking (was: Re: File Question

Yannick Grams

3/3/2007 11:19:00 AM

Well, I'm not interested in programming seriously. I just do it as a hobby.
But thanks again. Also, one quick (hopefully last) quick question:

I attempted the first part of the code that you gave me, the CHARACTERS
array.

CHARBLOCK = {
?a = [
"...@@@....",
".@@@@@@@..",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@@@@@@@.",
"@@@@@@@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@."
],
?b = [
"...@@@@@@.",
".@@@@@@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@..",
"@@@@@@@...",
"@@@@@@@@..",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@@@@@@..",
"@@@@@@...."
],
?c = [
"...@@@@@@.",
".@@@@@@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@.......",
"@@@.......",
"@@@.......",
"@@@.......",
"@@@.......",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@@@@@@..",
"@@@@@@...."
],
#and so on and so forth
}

However, I'm getting errors such as:
rb:2 odd number list for Hash ?a = [
rb:2 syntax error, unexpected "=", expecting "')"
rb:20 syntax error, unexpected ",", expecting $end

I'm not sure what I've done wrong here. If you could help me out one last
time, then I'd be very grateful. Thanks in advance.
>From: Robert Klemme <shortcutter@googlemail.com>
>Reply-To: ruby-talk@ruby-lang.org
>To: ruby-talk@ruby-lang.org (ruby-talk ML)
>Subject: Smart Way Thinking (was: Re: File Question)
>Date: Sat, 3 Mar 2007 20:10:05 +0900
>
>On 03.03.2007 11:41, Yannick Grams wrote:
>>Thankyou very much for the helpful hints. A quick question: how long does
>>it take until one is able to think of smart ways around programming? I've
>>been doing this for about a year, and I have improved greatly, but not as
>>much as I should like.
>
>Um, that's a much more difficult question than the other one. :-) The
>general answer to this is probably (as often) "it depends". For me it
>certainly took a degree in computer science plus several years software
>development and probably also several programming languages. Others might
>get the hang of it faster or slower - that probably depends on yourself and
>your occupation (doing software development full time certainly helps) and
>what other factors you can think of.
>
>Studying CR certainly helps as this will provide you with some basic
>concepts and basic understanding (for example, estimating algorithmic
>complexity) but that brings you only half there. I do not know a proper
>replacement for experience, as you can learn all the principles in theory
>but you will be able to apply them properly only with experience. Also,
>there is a ton of other issues in practice that the university did not
>teach us at the time I was attending.
>
>The single most important concept in software engineering is IMHO
>abstraction. By abstraction I mean the way how you distribute
>functionality across a system (this holds true for large as well small
>pieces of software). Create artifacts (classes, methods, functions) that
>do one thing properly. The hard bit is often to determine what this "one
>thing" is. :-)
>
>Having said that, you should probably be a bit more patient. :-)
>
>Kind regards
>
> robert
>

_________________________________________________________________
Advertisement: It's simple! Sell your car for just $20 at carsales.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801577%2Fpi%5F1005244%2Fai%5F838588&_t=757768878&_r=endtext_simple&...


1 Answer

Robert Klemme

3/3/2007 11:54:00 AM

0

On 03.03.2007 12:18, Yannick Grams wrote:
> Well, I'm not interested in programming seriously. I just do it as a
> hobby. But thanks again. Also, one quick (hopefully last) quick question:
>
> I attempted the first part of the code that you gave me, the CHARACTERS
> array.

My fault, I should have tested the code. You need "=>" instead of "=":


CHARBLOCK = {
?a => [
"...@@@....",
".@@@@@@@..",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@@@@@@@.",
"@@@@@@@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@.",
"@@@...@@@."
],
?b => [
....

robert