| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
Comments:
<0> can join make a scalar out of all the data in an array if i ommit the first argument somehow? <0> i mean i don't want a seperator <1> nocturnal: just do join( '', @array ) <0> thought so, thanks <1> nocturnal: that'll join it up with no separator <2> is this asking if $foo is a char? if($foo =~ /\D/) <3> won't "@array" do the same thing? <1> gleesond: well technically it's saying if $foo not a digit <1> gleesond: which could include high ascii characters, alphas, symbols, etc. <2> ides: ah thats not so good <1> gleesond: what are you wanting it to do? <4> harleypig: What do you mean? <2> er... I think there is error catching for it in the script I'm maintaining down the line <2> ides: it needs to see if foo is either C L S or a number
<3> eggzeck: I have to test it, but doesn't "@array" do the same as join '', @array? <5> nope <1> gleesond: if( $foo =~ /(C|L|S|\d)/ ) then <5> "@array" is the same as join $", @array <3> ah, that's right. <1> harleypig: yeah it'd only work if you set $" to '' <6> if ($foo =~ /[CLS\d]/ ) <6> rather :) <3> so { local $" ; "@array" } which is a little more obscure than join '', @array <1> yeah Botje's is better character cl***es are faster than alternations <6> clearer, mostly :) <1> I dunno, I find many people get confused about character cl***es <7> buubot: help! <8> Yaakov: Sorry, this bot has no interactive help. <7> I am not sorry, crapbot. <9> LOL <9> buubot: help! i'm dying! <8> dazjorz: Sorry, this bot has no interactive help. <9> :( <4> Man I'm hungry <4> eval: $foo = join '', @{[qw(hey you guys)]}; $foo; <8> eggzeck: heyyouguys <10> ruth, baby ruth! <11> If you guys had to match words on say a 10x10 grid of letters, backwards, diagonal, or any which way, how would you go about it? <10> wraparounds on edges? <11> Yeah <11> t c a wouldn't make cat <11> t a c would though etc <10> that means *no* wraparounds, then <11> Well, "wraparound" isn't really a universal term :) <11> I imagine that as meaning there's a limiting wrapped border <10> looking for specific words? <11> Any english words <11> Every possible english word that can be created would be the critera <10> is this a cl*** ***ignment or golf? <11> Cl*** ***ignment? <10> you don't understand the phrase? <11> A school cl***? <12> Is there any way to determine the bounds of a window in X via perl? <10> yes, a project ***igned by a teacher for school <11> Hardly <10> and since you ignored the othe roption, I guess itis not for golf <11> No it's not golf <11> I'm interested in seeing what methods people come up with for solving this <10> I'd make a 2d array for the grid, then build a string with each possible arrangement. e.g. if gride is cat on first line and act on second <11> So you'd build an array of every possible combination? <11> Might be a tad memory heavy. :) <10> I'd make "cat\nact" and "tac\ntca", etc. yeah, then once you have all combination you can throw a dictionary at matching any of those strings <11> Oh sorry, it's not just combinations, they have to be adjacent <10> no, not an array of every possible combination, just for the supplied grid <11> And each letter is used once <11> Yeah that's what I mean. An array of every possible combination for the supplied grid <10> that doesn't change what I said <10> yeah <11> You couldn't make tca out of "c a t" on a grid <10> that was my second row of grid <11> Ah ok :) <10> "tac\ntca" was made from taking each row backwards <10> act was actualyl second line <11> I see.
<11> Everyone seems to come up with pretty much that same solution :) <11> No one's spotted the fast one <10> well, you have to have a static set to throw a dictionary at, so delineating them first is really the ebst way to do it <5> Woosta: X11::Protocol can get you a connection to the X server with all that info <10> you also didn't describe the problem well <11> O_o <11> I explained it satisfactorily <12> tybalt89: I'll have a look .. ta <10> bynari: lol you didn't even mention that letetrs could only be used once on ehte gride until 5 minutes later <10> obviously a shortcut can be made with that knowledge <11> A shortcut? What's the shortcut? <11> If you could re-use letters you'd end up with loops and a lot of h***le <10> the most simplistic would be chopping the size of your dictionary by quite a bit <7> tybalt89: I still haven't written anything with X11::Protocol. <11> dkr: A 10x10 grid has 100 letters <12> tybalt89: thanks .. looks good .. $x->unpack_reply('GetWindowAttributes', $data); <11> There's a large probability you'll have all 26 letters <10> how can you have 100 and only use each letetr once? <6> invent new letters <5> Woosta: $x->GetGeometry <13> you can't <12> Ooh .. sounds even nicer <13> pigeonhole principle <11> Eek. You're not understanding. You have a grid with letters. You have to make up words in that grid using the letters. Words can be formed in any direction and must be adjacent <5> Woosta: you have the window ID, right? <10> yeah, and my not understanding is completely my fault, you are describing the problem perfectly... ;) <14> dkr: right. <11> You cannot re-use the same letter twice. That doesn't mean you can't have 2 a's. It means you can't use the same 'square' twice <12> tybalt89: well .. that's another problem. But I figure that will be the easier part of it so I started at the other end <11> Everyone else has understood the problem, dkr <10> <11> If you guys had to match words on say a 10x10 grid of letters, backwards, diagonal, or any which way, how would you go about it? <10> "match words" means quite a different thing than creating words to put into the grid <11> It's a pretty standard word game <14> dkr: YES IT DOES. <11> Creating words?? What? <14> bynari: in any case, There's really only, what, 6 valid orientations for a word, right? <11> This isn't a difficult concept. Write grid on paper. Mark round each word you find <11> Yes, hobbs <11> It's just a cl***ic word game <10> you used the phrase "make up", I used th eword "create", same difference <5> Woosta: perl -MX11::Protocol -MData::Dumper -le '%w=X11::Protocol->new->GetGeometry(shift);print Dumper \%w' 38 # 38 happens to be my root window <12> Whoah <14> bynari: so you should be able to come up with transforms that map the board into 6 different 1-D strings <12> Mate! Thanks! <14> bynari: with \n's inserted where necessary to indicate the edges of the board <14> bynari: (conveniently, 3 of them will be reverses of the other 3) <11> 6 for the entire board? :) <14> bynari: then you can use a dictionary and index() <14> bynari: yes, 6 for the entire board. Why not? <11> Because there's thousands and thousands of possible combinations on a board <7> SKYKING SKYKING DO NOT ANSWER <10> there are some communications difficulties going on here <14> bynari: hang on a moment <15> Someone at 86.141.252.242 pasted "wordgrid" (13 lines, 81B) at http://sial.org/pbot/18280 <11> Have a look at that <11> Made up grid with a few solutions <10> you aren't understanding our solution <11> sted, stew, red too <14> bynari: okay, I missed. There's 8, not 6 ;) <11> I do understand *your* solution, dkr <11> I just said it's a bit inefficient <11> Sorry yes, 8. My bad too <11> 8 directions at each letter <9> gotta go :) <9> cya <10> using that example you describe forward words as: "jiel\nidwl\noera\nbstb", and the other directions, then you match each dictionary word against those strings <5> can words turn corners like Boggle ? <10> tybalt89: no wraparounds he said <11> Nah, tybalt89 <14> bynari: you were talking about a word search. Now you're talking about boggle? <10> oh you mean like an L shape? <11> I didn't mention boggle <14> bynari: you did when you said "8 directions at each letter" <5> yeah, like an L shape...
Return to
#perl or Go to some related
logs:
ubuntu usb wifi DWL-G132 bootsplash 2.4.31 slackware #openzaurus Ubuntu networkboot #fedora scponly lost connection enable multiverse etch #php webbles clips #openzaurus
|
|