Jump to content

I'm New and I need some help cleaning strings


Recommended Posts

I've made a hangman program and i have a set number of answers (it runs via a php script) I want to make an auto solver for it that can select the play field which looks similar to

_ _ _ _ _ _ _ _ _ _ _ _ &_ _ _ _ _ _ _ _ &_ _ _ & _ _ _

_ _& _ _ _ _ _ _ _ & _ _ _ _ _ _ _

It post really bad so i'm gonna replace the double sapces with a & but in real life they are double spaces.

The words are seperated bye double spaces and the individual letters are by single splits.

To solve the puzzles i have all the known solutions in arrays that are based on the nubmer of words in the puzzle. So it begins by highlighting the field sending that to the clipboard putting it in a variable and then i attempt to split it by every " " (double space) but for some reason its returning a $spacesplit[0] is equal to 58 which is not right. Is there a way i can use a double space as a delimiter for stringsplit without having it split at single spaces, or does someone have a better idea to solving this?

This is the script i'm using to see what it spltis like:

mousemove(145,742)

Mousedown("Left")

MouseMove(692,801)

MouseUP("Left")

sleep(250)

send("{CTRLDOWN}c{CTRLUP}")

$blank_puzzle = clipGet()

$2space = " "

$word_count = StringSplit($blank_puzzle, $2space)

msgbox(0, "", $word_count[0])

The message box returns something in the 50s

Edited by cooldude832
Link to comment
Share on other sites

You got a link to the hangman?

Link to comment
Share on other sites

I did something like this:

Global $sAnswer[3]
$sAnswer[0] = StringSplit("BRONTO BITES ARE ALL THE RAGE AND THEY ARE MEATY AND VERY EASY TO CARRY", " ")
$sAnswer[1] = StringSplit("WITH THE RIGHT TRAINING TUSKANINNIES CAN BECOME QUITE FEARSOME FIGHTERS", " ")
$sAnswer[2] = StringSplit("YOU SHOULD NOT THROW BASEBALLS UP WHEN THE CEILING FAN IS ON", " ")
Link to comment
Share on other sites

I did something like this:

Global $sAnswer[3]
$sAnswer[0] = StringSplit("BRONTO BITES ARE ALL THE RAGE AND THEY ARE MEATY AND VERY EASY TO CARRY", " ")
$sAnswer[1] = StringSplit("WITH THE RIGHT TRAINING TUSKANINNIES CAN BECOME QUITE FEARSOME FIGHTERS", " ")
$sAnswer[2] = StringSplit("YOU SHOULD NOT THROW BASEBALLS UP WHEN THE CEILING FAN IS ON", " ")

I've got the rest of the script my issue is in looking at the original puzzle and gathering information off it like # of words in it etc etc.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...