Results 1 to 20 of 20

Thread: Array help.

  1. #1
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Array help.


    http://www.mychildplayhouses.com/geo...in-deluxe.html

    Cracking this bitch.

    Need some help with getting the array declaration of the LetterWheels part to actually run. (compiles fine)

    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P Y - 4 points
    J W V X  - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: array[1..8] of array[0..9] of string;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.

    8 Lettered words.

    http://74.125.155.132/search?q=cache...&ct=clnk&gl=us

    Going to need to probably add 4 lettered words - 7 lettered words.

    Any ideas?

    EDIT

    Problem solved

    SCAR Code:
    LetterWheels: array[1..8] of array[0..9] of string;
    change to
    SCAR Code:
    LetterWheels: array[1..8] of array of string;

    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P Y - 4 points
    J W V X  - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: array[1..8] of array of string;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.

  2. #2
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Idk what your trying to do, but by looking at it, you are using your 2 dimensional array improperly.

    Try This:
    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P - 4 points
    J W V X Y - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: array[1..8] of array of string;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      for I := 1 to 8 do
        SetLength(LetterWheels[I], 10);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.



    ~NS

  3. #3
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    This seems to work for me:

    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P - 4 points
    J W V X Y - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: T2DStringArray;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      SetLength(LetterWheels, 9);
      for I := 1 to 8 do
        SetLength(LetterWheels[i], 10);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        //WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.
    :-)

  4. #4
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So are you trying to get all possible combinations or what?

  5. #5
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Method View Post
    This seems to work for me:

    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P - 4 points
    J W V X Y - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: T2DStringArray;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      SetLength(LetterWheels, 9);
      for I := 1 to 8 do
        SetLength(LetterWheels[i], 10);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        //WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.
    Its basically the same thing, but if you tend on using T2DStringArray, then for I := 1 to 8 do SetLength(LetterWheels[i], 10); is not needed.



    ~NS

  6. #6
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    Idk what your trying to do, but by looking at it, you are using your 2 dimensional array improperly.

    Try This:
    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P Y - 4 points
    J W V X  - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: array[1..8] of array of string;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      for I := 1 to 8 do
        SetLength(LetterWheels[I], 10);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.

    TY

    ~NS
    Quote Originally Posted by Da 0wner View Post
    So are you trying to get all possible combinations or what?
    Using every word to determine the best possible word to solve it with. A word that will result in the highest number of points received. Each letter has a certain amount of points none,2,4,6,8. The main dilemma is there are 8 letter wheels with 10 letters on each one which I have put into an array. There is more coding that needs to be done but I ran into a speed bump trying to declare the array.

    So far the best word I've discovered manually (with out the cracker) is

    Walkways = 28 points

    W6 A L2 K8 W6 A Y4 S2

    Quote Originally Posted by Nadeem View Post
    Its basically the same thing, but if you tend on using T2DStringArray, then for I := 1 to 8 do SetLength(LetterWheels[i], 10); is not needed.



    ~NS
    Please elaborate... what do I do then?

    EDIT

    Problem solved

    SCAR Code:
    LetterWheels: array[1..8] of array[0..9] of string;
    change to
    SCAR Code:
    LetterWheels: array[1..8] of array of string;

    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P Y - 4 points
    J W V X  - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: array[1..8] of array of string;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.

    Anyone got any ideas or want to help me complete it?

  7. #7
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm still not entirely sure what you want to do... but I made this so far, tell me which one is heading in the right direction

    SCAR Code:
    procedure MagnetToyCracker;
    var I, II, FileNum, Points: Integer;
        Words: string;
        Word: TStringArray;
        Points: array [0..5] of array of Char;
        LetterWheels: array [1..8] of array of Char;
    begin
      try
        FileNum := OpenFile(ScriptPath + 'EightLetterWords.txt', False);
        ReadFileString(FileNum, Words, FileSize(FileNum));
        CloseFile(FileNum);
      except end;
     
      Writeln('Entering Words Into An Array...');
      Word := Explode(' ', Words);
      Writeln('Word Array Complete...Now Scanning For Highest Points...');

      Point[0] := ['A', 'E', 'I', 'O', 'U'];
      Point[1] := ['B', 'C', 'F', 'G', 'L', 'N', 'R', 'S', 'T'];
      Point[2] := ['D', 'H', 'M', 'P'];
      Point[3] := ['J', 'W', 'V', 'X', 'Y'];
      Point[4] := ['K', 'Q', 'Z'];
     
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
     
      {for I := 0 to High(Word) - 1 do
        for II := 0 to 4 do
        begin
       
        end;}

    end;

    var
      T: integer;
    begin
      ClearDebug;
      T := GetSystemTime;
      MagnetToyCracker;
      Writeln((GetSystemTime - T));
    end.

    The length of the Word array will determine how many words that we are looking at scanning through, aswell as an easy way to deal with each word. But this is extremely time consuming due to so many words... A quicker way would be to count how many spaces there are to determine number of words.

    Im still not sure though if you want to calculate number of points for every single word, or are you looking to eliminate the words that do not start LetterWheels[1], and second letter does not contain LetterWheels[2] and etc...



    ~NS

  8. #8
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Hey please explain? Do you wan't a Word Cracker?

    ~Home

  9. #9
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    I'm still not entirely sure what you want to do... but I made this so far, tell me which one is heading in the right direction

    SCAR Code:
    procedure MagnetToyCracker;
    var I, II, FileNum, Points: Integer;
        Words: string;
        Word: TStringArray;
        Points: array [0..5] of array of Char;
        LetterWheels: array [1..8] of array of Char;
    begin
      try
        FileNum := OpenFile(ScriptPath + 'EightLetterWords.txt', False);
        ReadFileString(FileNum, Words, FileSize(FileNum));
        CloseFile(FileNum);
      except end;
     
      Writeln('Entering Words Into An Array...');
      Word := Explode(' ', Words);
      Writeln('Word Array Complete...Now Scanning For Highest Points...');

      Point[0] := ['A', 'E', 'I', 'O', 'U'];
      Point[1] := ['B', 'C', 'F', 'G', 'L', 'N', 'R', 'S', 'T'];
      Point[2] := ['D', 'H', 'M', 'P'];
      Point[3] := ['J', 'W', 'V', 'X', 'Y'];
      Point[4] := ['K', 'Q', 'Z'];
     
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
     
      {for I := 0 to High(Word) - 1 do
        for II := 0 to 4 do
        begin
       
        end;}

    end;

    var
      T: integer;
    begin
      ClearDebug;
      T := GetSystemTime;
      MagnetToyCracker;
      Writeln((GetSystemTime - T));
    end.

    The length of the Word array will determine how many words that we are looking at scanning through, aswell as an easy way to deal with each word. But this is extremely time consuming due to so many words... A quicker way would be to count how many spaces there are to determine number of words.

    Im still not sure though if you want to calculate number of points for every single word, or are you looking to eliminate the words that do not start LetterWheels[1], and second letter does not contain LetterWheels[2] and etc...



    ~NS
    Do you under stand why this doesn't work?

    SCAR Code:
    var
      LetterWheels: array of array of Char;

    begin
      LetterWheels := [['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'],
                       ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'],
                       ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'],
                       ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'],
                       ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'],
                       ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'],
                       ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'],
                       ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u']];
    end.

    Let me explain this one more time

    This toy is called word spin, the objective of the game is to score the highest possible amount of points by creating an actual word by turning and re-arranging the 8 letter wheels (each wheel has 10 letters). Some letters are worth 0 points, 2, 4, 6, or 8 points each. (see point list for specifics)

    For now I'm worried only about 8 lettered words even though it is possible that a 7 lettered word, 6 lettered word, and maybe even a 5 are the highest possible outcome, but I want to get the code working with 8 only before I mess with that.

    There's a couple of dilemmas (all of which are probably solvable) the first one being is that not every word on that list is make-able with the toy because they're are a limited number of letters of each letter and you have to pay attention to what wheel each letter is on because you might end up with 'enough letters total' but the letters will be on the same wheel making it impossible for them to all be on one side.

    The second dilemma is actually coding a way for SCAR to actually interpret and know how many points each letter is worth, and whether or not a word on the word list is make-able with the toy. This means I'm going to have to be super creative and efficient with my arrays, variables, timing, and algorithms. (to ultimately determine the best possible real word)

    I noticed you used explode to put all the words into a giant array, this is what I tried at first but is not a good idea because an array consists of variables which take up memory and when you have that many words it can take up a crap load of memory which is why I have a simple :

    SCAR Code:
    I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
      until (CurrentWord = 'zyzzyvas');

    That needs serious elaboration to actually intellectuality process the word list for my purposes, but you see it is much more efficient to leave out the giant array created with the explode function proposal.

  10. #10
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Man, i still don't get it

    But here is something? I'm not sure did you mean this?




    PHP Code:
    var
      
    LetterWheelsTStringArray;

    begin
      LetterWheels 
    := ['o''y''w''i''e''n''a''s''u''x',
                       
    'u''d''i''b''e''h''o''c''a''t',
                       
    'm''o''f''u''z''a''n''i''l''e',
                       
    'p''e''d''o''h''u''s''i''r''a',
                       
    'e''n''k''a''f''b''o''l''i''r',
                       
    'i''d''w''a''v''j''e''r''t''q',
                       
    'l''a''v''n''t''w''e''p''g''s',
                       
    'c''r''o''y''e''n''t''m''g''u'];
    end

    ~Home

  11. #11
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I understand that, my question was:

    the 8 letter word, so the first letter MUST contain a letter from Wheel 1, the second letter MUST contain a letter from Wheel 2, the third letter MUST contain a letter from Wheel 3, and etc...

    Also this is exactly what we need to calculate the points:
    SCAR Code:
    Point[0] := ['A', 'E', 'I', 'O', 'U'];
    Point[1] := ['B', 'C', 'F', 'G', 'L', 'N', 'R', 'S', 'T'];
    Point[2] := ['D', 'H', 'M', 'P'];
    Point[3] := ['J', 'W', 'V', 'X', 'Y'];
    Point[4] := ['K', 'Q', 'Z'];

    Because if you loop through that, all you gotta do is multiply the loop integer by two in order to get the amount of points.

    example:
    0 x 2 = 0 points
    1 x 2 = 2 points
    2 x 2 = 4 points
    3 x 2 = 6 points
    4 x 2 = 8 points



    ~NS

  12. #12
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Home View Post
    Man, i still don't get it

    But here is something? I'm not sure did you mean this?




    PHP Code:
    var
      
    LetterWheelsTStringArray;

    begin
      LetterWheels 
    := ['o''y''w''i''e''n''a''s''u''x',
                       
    'u''d''i''b''e''h''o''c''a''t',
                       
    'm''o''f''u''z''a''n''i''l''e',
                       
    'p''e''d''o''h''u''s''i''r''a',
                       
    'e''n''k''a''f''b''o''l''i''r',
                       
    'i''d''w''a''v''j''e''r''t''q',
                       
    'l''a''v''n''t''w''e''p''g''s',
                       
    'c''r''o''y''e''n''t''m''g''u'];
    end

    ~Home
    The idea is to get 8 arrays of 10 letters in each one, that is one gaint array. Nice try though

    Quote Originally Posted by Nadeem View Post
    I understand that, my question was:

    the 8 letter word, so the first letter MUST contain a letter from Wheel 1, the second letter MUST contain a letter from Wheel 2, the third letter MUST contain a letter from Wheel 3, and etc...

    Also this is exactly what we need to calculate the points:
    SCAR Code:
    Point[0] := ['A', 'E', 'I', 'O', 'U'];
    Point[1] := ['B', 'C', 'F', 'G', 'L', 'N', 'R', 'S', 'T'];
    Point[2] := ['D', 'H', 'M', 'P'];
    Point[3] := ['J', 'W', 'V', 'X', 'Y'];
    Point[4] := ['K', 'Q', 'Z'];

    Because if you loop through that, all you gotta do is multiply the loop integer by two in order to get the amount of points.

    example:
    0 x 2 = 0 points
    1 x 2 = 2 points
    2 x 2 = 4 points
    3 x 2 = 6 points
    4 x 2 = 8 points



    ~NS
    Here's what you missed, "you can re-arrange and turn the wheels" that means wheel 8 can be the first letter or wheel 4 it doesn't matter what order the wheels are in.

    Each wheel is magnetic and you can take it apart and move them around. (each wheel will always contain the same 10 letters though)

    I'm trying to find the best possible word to solve it with that will give me the most points.

  13. #13
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Haha I think I get it now, but I still sense it will take a good load of time for it to finish searching all of that



    ~NS

  14. #14
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    Haha I think I get it now, but I still sense it will take a good load of time for it to finish searching all of that



    ~NS
    On my computer (512mb ram) it takes about 43 seconds to process the word list... so in essence its possible and in a relatively short amount of time... maybe even around 0 seconds with out the WriteLn part I put in there for pretty much no reason.

    Code:
    ...
    zymogens
    zymogram
    zymology
    zymosans
    zyzzyvas
    28414 words used.
    Took 37 seconds.
    Successfully executed
    Code:
    28414 words used.
    Took 0 seconds.
    Successfully executed
    The WriteLn is what slows it down.

  15. #15
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    On my computer (512mb ram) it takes about 43 seconds to process the word list... so in essence its possible and in a relatively short amount of time... maybe even around 0 seconds with out the WriteLn part I put in there for pretty much no reason.

    Code:
    ...
    zymogens
    zymogram
    zymology
    zymosans
    zyzzyvas
    28414 words used.
    Took 37 seconds.
    Successfully executed
    Code:
    28414 words used.
    Took 0 seconds.
    Successfully executed
    The WriteLn is what slows it down.
    Could you tell me what is the script atm? What you are running

    ~Home

  16. #16
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You need to copy the list from http://74.125.155.132/search?q=cache...ient=firefox-a and save it into a .txt file (use notepad) and place it in the same folder as the script (that means you need to save the below to a SCAR script file first)

    SCAR Code:
    program MagnetToyCracker;

    {.Include SRL\SRL.SCAR}

    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P Y - 4 points
    J W V X  - 6 points
    K Q Z - 8 points}


    procedure Unknown;
    var
      LetterWheels: array[1..8] of array of string;
      EightLetteredWords, CurrentWord: string;
      WordsFile, I, Count: LongInt;
    begin
      OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      ReadFileString(WordsFile, EightLetteredWords, FileSize(WordsFile));
      CloseFile(WordsFile);
      LetterWheels[1] := ['o', 'y', 'w', 'i', 'e', 'n', 'a', 's', 'u', 'x'];
      LetterWheels[2] := ['u', 'd', 'i', 'b', 'e', 'h', 'o', 'c', 'a', 't'];
      LetterWheels[3] := ['m', 'o', 'f', 'u', 'z', 'a', 'n', 'i', 'l', 'e'];
      LetterWheels[4] := ['p', 'e', 'd', 'o', 'h', 'u', 's', 'i', 'r', 'a'];
      LetterWheels[5] := ['e', 'n', 'k', 'a', 'f', 'b', 'o', 'l', 'i', 'r'];
      LetterWheels[6] := ['i', 'd', 'w', 'a', 'v', 'j', 'e', 'r', 't', 'q'];
      LetterWheels[7] := ['l', 'a', 'v', 'n', 't', 'w', 'e', 'p', 'g', 's'];
      LetterWheels[8] := ['c', 'r', 'o', 'y', 'e', 'n', 't', 'm', 'g', 'u'];
      I := -8;
      repeat
        I := I + 9;
        CurrentWord := Copy(EightLetteredWords, I, 8);
        WriteLn(CurrentWord);
        //Wait(1); idk
        Count := Count + 1;
      until (CurrentWord = 'zyzzyvas');
      WriteLn(IntToStr(Count) + ' words used.');
    end;

    begin
      ClearDebug;
      Unknown;
      WriteLn('Took ' + LowerCase(TimeRunning) + '.');
    end.

  17. #17
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    jaywalks for 30.

    Currently letting it run overnight, if all turns out well I'll share the code. It works flexibly, so to test other length words just pass it a different file and alter a number so it reads x chars instead of 8 at a time

    Edit:
    New high score(30): skydived
    New high score(30): skywards
    New high score(34): sovkhozy

    It appears to have run faster than I thought. It would probably be easier for you to test their validity than I, so if they turn out to be possible values, then there's a good chance sovkhozy is the high score, though whether or not you deem it a true word is another story. If not, then there may be a 32 or two since it only prints out equal to or greater than the current high score.

    SCAR Code:
    program ConstructWord;

    function Wordy(wrd: string; let: TStringArray): Boolean;
    var
      l, i: Integer;
      lA: TStringArray;
    begin
      if (wrd = '') then
      begin
        Result := True;
        exit;
      end;
      Result := False;
      for l := 0 to High(let) do
      begin
        if (Pos(wrd[1], let[l]) > 0) then
        begin
          SetLength(lA, Length(let));
          for i := 0 to High(lA) do
            lA[i] := let[i];
          for i := l to High(lA) - 1 do
            Swap(lA[i], lA[i + 1]);
          SetLength(lA, High(lA));
          if ((Length(wrd) = 1) or (Wordy(Copy(wrd, 2, High(wrd)), lA))) then
          begin
            Result := True;
            exit;
          end;
        end;
      end;
    end;


    var
      f, p, l, i, cs, hs: Integer;
      s: string;
    begin
      Writeln('Begin');

      f := OpenFile(AppPath + 'words', False);
      l := FileSize(f);
      hs := -1;
     
      while (p < l) do
      begin
        p := p + 9;
        ReadFileString(f, s, 8);
        if (Wordy(s, ['oywienasux', 'udibehocat', 'mofuzanile', 'pedohusira', 'enkafbolir', 'idwavjertq', 'lavntwepgs', 'croyentmgu'])) then
        begin
          cs := 0;
          for i := 1 to Length(s) do
          begin
            // if (Pos(s[i], 'aeiou') > 0) then cs := cs + 0 else // since they don't add anything, no point coutning
            if (Pos(s[i], 'bcfglnrst') > 0) then
              cs := cs + 2
            else if (Pos(s[i], 'dhmp') > 0) then
              cs := cs + 4
            else if (Pos(s[i], 'jwvxy') > 0) then
              cs := cs + 6
            else if (Pos(s[i], 'kqz') > 0) then
              cs := cs + 8;
          end;

          if (cs >= hs) then
          begin
            hs := cs;
            Writeln('New high score(' + IntToStr(hs) + '): ' + s);
          end;
        end;
        ReadFileString(f, s, 1);
      end;
      CloseFile(f);
      Writeln('End');
    end.

    This relies on the words file, which it reads for input, to be in the Scar folder. Feel free to alter this. For different word lengths, change the number the it reads (default 8) - ReadFileString(f, s, 8); - to the length of the words currently being tested.
    Last edited by mixster; 07-14-2009 at 07:35 AM.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  18. #18
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mixster View Post
    jaywalks for 30.

    Currently letting it run overnight, if all turns out well I'll share the code. It works flexibly, so to test other length words just pass it a different file and alter a number so it reads x chars instead of 8 at a time
    Jaywalks is only 28 ties with walkways. Nice. Don't forget about two dilemmas I posted.

    Edit: Y is only 4 points lol, sorry. that's why it is only 28 let me change that in the scripts.

    SCAR Code:
    {A E I O U - 0 points
    B C F G L N R S T - 2 points
    D H M P Y - 4 points
    J W V X  - 6 points
    K Q Z - 8 points}

  19. #19
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mixster View Post
    jaywalks for 30.

    Currently letting it run overnight, if all turns out well I'll share the code. It works flexibly, so to test other length words just pass it a different file and alter a number so it reads x chars instead of 8 at a time

    Edit:
    New high score(30): skydived
    New high score(30): skywards
    New high score(34): sovkhozy

    It appears to have run faster than I thought. It would probably be easier for you to test their validity than I, so if they turn out to be possible values, then there's a good chance sovkhozy is the high score, though whether or not you deem it a true word is another story. If not, then there may be a 32 or two since it only prints out equal to or greater than the current high score.

    SCAR Code:
    program ConstructWord;

    function Wordy(wrd: string; let: TStringArray): Boolean;
    var
      l, i: Integer;
      lA: TStringArray;
    begin
      if (wrd = '') then
      begin
        Result := True;
        exit;
      end;
      Result := False;
      for l := 0 to High(let) do
      begin
        if (Pos(wrd[1], let[l]) > 0) then
        begin
          SetLength(lA, Length(let));
          for i := 0 to High(lA) do
            lA[i] := let[i];
          for i := l to High(lA) - 1 do
            Swap(lA[i], lA[i + 1]);
          SetLength(lA, High(lA));
          if ((Length(wrd) = 1) or (Wordy(Copy(wrd, 2, High(wrd)), lA))) then
          begin
            Result := True;
            exit;
          end;
        end;
      end;
    end;


    var
      f, p, l, i, cs, hs: Integer;
      s: string;
    begin
      Writeln('Begin');

      f := OpenFile(ScriptPath + 'EightLetteredWords.TXT', False);
      l := FileSize(f);
      hs := -1;

      while (p < l) do
      begin
        p := p + 9;
        ReadFileString(f, s, 8);
        if (Wordy(s, ['oywienasux', 'udibehocat', 'mofuzanile', 'pedohusira', 'enkafbolir', 'idwavjertq', 'lavntwepgs', 'croyentmgu'])) then
        begin
          cs := 0;
          for i := 1 to Length(s) do
          begin
            // if (Pos(s[i], 'aeiou') > 0) then cs := cs + 0 else // since they don't add anything, no point coutning
            if (Pos(s[i], 'bcfglnrst') > 0) then
              cs := cs + 2
            else if (Pos(s[i], 'dhmpy') > 0) then
              cs := cs + 4
            else if (Pos(s[i], 'jwvx') > 0) then
              cs := cs + 6
            else if (Pos(s[i], 'kqz') > 0) then
              cs := cs + 8;
          end;

          if (cs >= hs) then
          begin
            hs := cs;
            Writeln('New high score(' + IntToStr(hs) + '): ' + s);
          end;
        end;
        ReadFileString(f, s, 1);
      end;
      CloseFile(f);
      Writeln('End');
    end.

    This relies on the words file, which it reads for input, to be in the Scar folder. Feel free to alter this. For different word lengths, change the number the it reads (default 8) - ReadFileString(f, s, 8); - to the length of the words currently being tested.
    Y is 4 points lol fix this

    Fixed:

    SCAR Code:
    if (Pos(s[i], 'bcfglnrst') > 0) then
              cs := cs + 2
            else if (Pos(s[i], 'dhmpy') > 0) then
              cs := cs + 4
            else if (Pos(s[i], 'jwvx') > 0) then
              cs := cs + 6
            else if (Pos(s[i], 'kqz') > 0) then
              cs := cs + 8;

    This is some damn nice code, interesting style...

    It seems to be working so far, I tried sovkhozy and got 32 points

    http://dictionary.reference.com/browse/sovkhozy

    sov⋅khoz
      /ˈsɒvkɔz/ Show Spelled Pronunciation [sov-kawz]
    –noun, plural -kho⋅zy /-kɔzi/ Show Spelled Pronunciation [-kaw-zee] , -khoz, -khoz⋅es.
    (in the former U.S.S.R) a state-owned wage-paying farm

    I'm going to rewrite your code and add a GUI form.

    Edit: Just tested with word lists 1-8 and sovkawz is the highest at 32 points. second place would be anything with 28 points which is achievable with other 8 lettered words or some 7 lettered ones.

  20. #20
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    My bad about the y

    Anyway, before you add the GUI, I updated it a bit:
    SCAR Code:
    program ConstructWord;

    function Wordy(wrd: string; let: TStringArray; var bools: array of Boolean; var order: string): Boolean;
    var
      l: Integer;
    begin
      if (wrd = '') then
      begin
        Result := True;
        exit;
      end;
      Result := False;
      for l := 0 to High(let) do
      begin
        if(bools[l]) then
          Continue;
        if (Pos(wrd[1], let[l]) > 0) then
        begin
          bools[l] := True;
          if ((Length(wrd) = 1) or (Wordy(Copy(wrd, 2, High(wrd)), let, bools, order))) then
          begin
            Result := True;
            order := order + IntToStr(l) + ',';
            exit;
          end else
            bools[l] := False;
        end;
      end;
    end;


    var
      f, p, l, i, cs, hs: Integer;
      s, o: string;
      bA: array of Boolean;
    begin
      Writeln('Begin');

      f := OpenFile(AppPath + 'words', False);
      l := FileSize(f);
      hs := -1;
      SetLength(bA, 8);

      while (p < l) do
      begin

        p := p + 9;
        ReadFileString(f, s, 8);
        o := '';
        for i := 0 to High(bA) do
          bA[i] := False;
       
        if (Wordy(s, ['oywienasux', 'udibehocat', 'mofuzanile', 'pedohusira', 'enkafbolir', 'idwavjertq', 'lavntwepgs', 'croyentmgu'], bA, o)) then
        begin
          cs := 0;
          for i := 1 to Length(s) do
          begin
            // if (Pos(s[i], 'aeiou') > 0) then cs := cs + 0 else // since they don't add anything, no point coutning
            if (Pos(s[i], 'bcfglnrst') > 0) then
              cs := cs + 2
            else if (Pos(s[i], 'dhmpy') > 0) then
              cs := cs + 4
            else if (Pos(s[i], 'jwvx') > 0) then
              cs := cs + 6
            else if (Pos(s[i], 'kqz') > 0) then
              cs := cs + 8;
          end;

          if (cs >= hs) then
          begin
            hs := cs;
            Writeln('New high score(' + IntToStr(hs) + '): ' + s + ', produced with order ' + o);
          end;
        end;

        ReadFileString(f, s, 1);
      end;
      Writeln('End');
    end.

    Now it (can) spit/s out the wheels in reverse order of how to arrange them to generate the word and I believe it runs faster since it doesn't have to do crazy looping to setup the local TStringArray
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •