Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

edit: oh, I got something:

/Users/JohnM/Desktop/word_chain2.rb: line 2: FILENAME: command not found
/Users/JohnM/Desktop/word_chain2.rb: line 6: NO_PROGRESS_CUTOFF: command not found
/Users/JohnM/Desktop/word_chain2.rb: line 10: PURE_PATTERN_MATCHING: command not found
/Users/JohnM/Desktop/word_chain2.rb: line 14: PROMPT_FIRST_WORD: command not found
/Users/JohnM/Desktop/word_chain2.rb: line 17: START_WORD: command not found
/Users/JohnM/Desktop/word_chain2.rb: line 23: syntax error near unexpected token `('
/Users/JohnM/Desktop/word_chain2.rb: line 23: `def parse_textfile(filename)'

That's the default terminal shell trying to execute the script rather than ruby.

try adding

Code:
#!/usr/bin/env ruby

to the very top of word_chain2.rb

then try ./word_chain2.rb again
 
That's the default terminal shell trying to execute the script rather than ruby.

try adding

Code:
#!/usr/bin/env ruby

to the very top of word_chain2.rb

then try ./word_chain2.rb again

Awesome. It works phenomenally. Thank you. Now, is it possible to throw in something that prevents wildcar repeats after the first 10 combos? i.e. if the tenth combo was 3+0+1+2, the next combo cannot start with a 2.

If not, thanks anyway.
 
Awesome. It works phenomenally. Thank you. Now, is it possible to throw in something that prevents wildcar repeats after the first 10 combos? i.e. if the tenth combo was 3+0+1+2, the next combo cannot start with a 2.

Not sure I follow you

if one has [3012][3012]...{7 more times}...[3012] then the next sequence should NOT start with a '2' ? Nor should it start with anything BUT a '3' (continue the pattern)?

Is this the FIRST 10 combos, or ANY sequence of 10 combos?

Perhaps you should rephrase what you want (no promises that I'll do it anyway)

And because I'm curious, what is this whole thing for?
 
Not sure I follow you

if one has [3012][3012]...{7 more times}...[3012] then the next sequence should NOT start with a '2' ? Nor should it start with anything BUT a '3' (continue the pattern)?

Is this the FIRST 10 combos, or ANY sequence of 10 combos?

Perhaps you should rephrase what you want (no promises that I'll do it anyway)

And because I'm curious, what is this whole thing for?

As it is now, it changes in every position and then (after 4 changes) allows a change in any position. What I am suggesting is that after I complete a word cycle (i.e. every letter index has been changed), then I should no longer be able to change the same index I changed previously. If I change RAKE to BITS through 4 letter changes, and the last letter I changed was R>B, I cannot change B to anything else until I have changed either I, T, or S. Take for example, the following word cycles:

[3021][1302][1023][1320][3120][3210][0312]

If we look at them as a string...

3,0,2,1,1,3,0,2,1,0,2,3,1,3,2,0,3,1,2,0,0,3,1,2

You can see that between the first and second sequences, there is a repeated "1" (numbers 4 and 5 in the string).

I want to disallow this.
 
Last edited:
Not sure I follow you

if one has [3012][3012]...{7 more times}...[3012] then the next sequence should NOT start with a '2' ? Nor should it start with anything BUT a '3' (continue the pattern)?

Is this the FIRST 10 combos, or ANY sequence of 10 combos?

Perhaps you should rephrase what you want (no promises that I'll do it anyway)

And because I'm curious, what is this whole thing for?

It's to cheat in an online flash game to impress/swindle friends. He said "make money", but how one does so in a game like this is tough to figure out. I couldn't find the original "help me cheat on games" thread, but there was this game and a few others, such as locating US cities on a map.

I guess sometimes it's more fun to talk others into doing reasonably involved coding to play a game for you rather than playing it yourself?

-Lee
 
1) This actually hurts your result chain (basically any restrictions in word choice will reduce the result size)

2) Your exception about the first 10 choices makes no difference to this implementation. Basically the program starts with the base word and starts chaining words together. If it hits a dead end, it backs up one step and tries a different path. If the program had time to actually finish it would have checked all possible branches, but because it stops after it hits a local maxima, earlier decisions in the path are never revisited to see if a better early choice would have made a difference. In other words, the earlier a decision is made on a step, the less likely that decision is to be re-evaluated for a better final result.
 
1) This actually hurts your result chain (basically any restrictions in word choice will reduce the result size)

2) Your exception about the first 10 choices makes no difference to this implementation. Basically the program starts with the base word and starts chaining words together. If it hits a dead end, it backs up one step and tries a different path. If the program had time to actually finish it would have checked all possible branches, but because it stops after it hits a local maxima, earlier decisions in the path are never revisited to see if a better early choice would have made a difference. In other words, the earlier a decision is made on a step, the less likely that decision is to be re-evaluated for a better final result.

1) I realize this.

2) I did not realize this and therefore I withdraw the "first 10 choices" exception, but I'd still like to prevent wildchar repeats.
 
It's to cheat in an online flash game to impress/swindle friends. He said "make money", but how one does so in a game like this is tough to figure out. I couldn't find the original "help me cheat on games" thread, but there was this game and a few others, such as locating US cities on a map.

Thanks.

It was a fun programming problem, if nothing else.

helpmeman:
if you are using this program for tangible personal gain or for an unfair advantage against others, I do not condone it. However if you are doing it for a laugh or high score, let me know how it goes.
 
It's to cheat in an online flash game to impress/swindle friends. He said "make money", but how one does so in a game like this is tough to figure out. I couldn't find the original "help me cheat on games" thread, but there was this game and a few others, such as locating US cities on a map.

I guess sometimes it's more fun to talk others into doing reasonably involved coding to play a game for you rather than playing it yourself?

-Lee

All traces of that other thread have been removed. As was my query here whether this new thread was related to the other thread. I don't know why all that stuff was deleted.

The only remaining evidence is this thread by the OP:
https://forums.macrumors.com/threads/1099690/

He asks for help to "... generate a random word from a database of words and enter it into a searchbox." and posts some non-working code. My last comment there is to try the suggestion made in his other thread, which would only make sense when that other thread existed.
 
All traces of that other thread have been removed.<snip>

Google still has a cache, but the mods have deleted the thread. It's probably a bit childish/vindictive to bring it up at all, but seeking help like this in a place normally dedicated to teaching/learning/getting help kind of miffs me. To be fair(er) to the OP, after re-reading the initial thread the point was just impressing people, not making money or scamming them, which is less bothersome.

-Lee
 
To be fair(er) to the OP, after re-reading the initial thread the point was just impressing people, not making money or scamming them, which is less bothersome.
-Lee

To be fair, I was directly asked what this was for and I thought it was implied that it was just for fun/curiosity. Therefore, I feel that any question as to the purpose of the project, indicates that it is too extensive to be done "just for fun" (if I was willing to do something "just for fun," I wouldn't have asked why it needs to be done in the first place, I'd just do it). The way I saw it, if I hadn't implied that I was somehow gaining from this or that I just wanted it for kicks, nobody would bite because they would see it as a waste of their time.

It's like when you ask a girl if she wants to hang out and then she asks "why?" you feel inclined to come up with a more urgent reason than "just for fun" because the inherent nature of the question was that it was "just for fun." Obviously, if she is asking why, that means the implied reason was not good enough.

Thanks.
However if you are doing it for a laugh or high score, let me know how it goes.

It went well until I realized that after like 10 complete words, I'm not able to change the same letter position even after 4 changes have been completed (i.e. no wildchar repeats). Which is why I asked about just preventing them entirely... (That should just be like one line-item right?)
 
Last edited:
To be fair, I was directly asked what this was for and the way I saw it, if I hadn't implied that I was somehow gaining from this or that I just wanted it for kicks, nobody would bite because they might see it as a waste of their time.
For me at least it makes it more of a waste of time than if you were just doing it for kicks or to learn something since you stand to benefit from it, but I don't.

The bigger problem (IMHO) is that you seem to want it done for you and don't seem to have any skin in the game or interest to learn.

That should just be like one line-item right?

Again I'd be far more inclined to help out if you actually tried something yourself.

B
 
For me at least it makes it more of a waste of time than if you were just doing it for kicks or to learn something since you stand to benefit from it, but I don't.

Is learning not benefiting? Either way, it seems I benefit and you don't.

balamw said:
Again I'd be far more inclined to help out if you actually tried something yourself.

Ok, what should I try?
 
Ok, what should I try?

Look at the code, hazard a guess as to where one might do the check you want, and why it should go there. Don't worry about the syntax yet, just aim for a higher level check of "I think I should [check this variable] and depending on the result [do this action] at this spot in the code because [this is what I'm thinking]"

Once you understand what you want to do and why, we can help you with the exact syntax.

Ruby is supposed to be fairly readable (disregarding my quick and dirty code, which isn't the best example to be learning off of), but iff you are having trouble understanding the code, there is a quick 20 minute tutorial you can read first.
 
If you want to run the script thus...

Code:
./my_script.rb

...you must explicitly call the interpreter in the script itself. Otherwise the shell has no idea what to do with it.

Add this as the first line of the script:

Code:
#!/usr/bin/ruby

To double check the path to your interpreter:

Code:
which ruby

[edit] I missed the reply above telling you this. :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.