• We just launched and are currently in beta. Join us as we build and grow the community.

Auto Search Word Generator

crackor

World Builder
C Rep
0
0
0
Rep
0
C Vouches
0
0
0
Vouches
0
Posts
110
Likes
33
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
In this tutorial we will create a game in C# called Auto Search Word Generator. This game creates a way of searching the word in the display letters in the form. And this game has a features to add, remove, generate, and show the answer of the list of words given or added by the user. Each word will be automatically generate and mix in the random letters and you will find out if what word will you want it to search and it will automatically show the exact word that you give. I will show you the sample code and images below.

Sample Code

Generating Script
  1. function

    generate(

    Words)
  2. {
  3. gridlength :=

    maxlength(

    listofwords)

    ;
  4. while

    (

    successful)
  5. {
  6. notfound :=

    false

    ;
  7. foreach (

    word in list)
  8. {
  9. word->

    Location :=

    Calculate(

    wordsplaced,

    word)

    ;
  10. if

    (

    Location ==

    null

    )
  11. {
  12. notfound :=

    true

    ;
  13. break

    ;
  14. }
  15. if

    (

    !

    notfound)
  16. {
  17. return

    FormGrid(

    words,

    locations)

    ;
  18. }
  19. else
  20. {
  21. gridlength++;
  22. }
  23. }
  24. }
  25. }

And for the Random Code

  1. private Letter[

    ]

    Next(

    Letter[

    ]

    [

    ]

    letters,

    string word,

    int

    length)
  2. {
  3. List<

    Point>

    all =

    new List<

    Point>

    (

    AllPoints(

    length)

    )

    ;
  4. while

    (

    all.Count

    >

    0

    )
  5. {
  6. int

    index =

    rand

    .Next

    (

    0

    ,

    all.Count

    )

    ;
  7. List<

    Direction>

    dirs =

    new List<

    Direction>

    (

    AllDirections(

    )

    )

    ;
  8. while

    (

    dirs.Count

    >

    0

    )
  9. {
  10. int

    index2 =

    rand

    .Next

    (

    0

    ,

    dirs.Count

    )

    ;
  11. Direction current =

    dirs[

    index2]

    ;
  12. Letter[

    ]

    c =

    Construct(

    all[

    index]

    ,

    current,

    word,

    length)

    ;
  13. bool legal =

    true

    ;
  14. for

    (

    int

    i =

    0

    ;

    i <

    c.Length

    ;

    i++

    )
  15. {
  16. if

    (

    c[

    i]

    .X

    <

    0

    ||

    c[

    i]

    .X

    >=

    length ||

    c[

    i]

    .Y

    <

    0

    ||

    c[

    i]

    .Y

    >=

    length)
  17. {
  18. legal =

    false

    ;
  19. break

    ;
  20. }
  21. else
  22. {
  23. for

    (

    int

    j =

    0

    ;

    j <

    letters.Length

    ;

    j++

    )
  24. {
  25. Point[

    ]

    pts =

    letters[

    j]

    .Select

    <

    Letter,

    Point>

    (

    t =>

    new Point(

    t.X

    ,

    t.Y

    )

    )

    .ToArray

    (

    )

    ;
  26. int

    _index2 =

    pts.ToList

    (

    )

    .FindIndex

    (

    t =>

    t.X

    ==

    c[

    i]

    .X

    &&

    t.Y

    ==

    c[

    i]

    .Y

    )

    ;
  27. if

    (

    _index2 !=

    -

    1

    )
  28. if

    (

    c[

    i]

    ._Letter !=

    letters[

    j]

    [

    _index2]

    ._Letter)
  29. legal =

    false

    ;
  30. }
  31. }
  32. }
  33. if

    (

    legal)
  34. return

    c;
  35. dirs.RemoveAt

    (

    index2)

    ;
  36. }
  37. all.RemoveAt

    (

    index)

    ;
  38. }
  39. return

    null

    ;
  40. }

dvdsvd.jpg


If you want to run this game in .exe application you must build and debug it again using Visual Studio. Don't forget to Like and Share. Enjoy Coding.


Download
You must upgrade your account or reply in the thread to view the hidden content.
 

452,496

338,631

338,639

Top