Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission - Abel Anderson #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AbelSAnderson
Copy link

CS Games 2023 Team A Application

Full Name

Abel Anderson

UWindsor Email

[email protected]

Application Form

Briefly explain how your solution works and how to run it

Explanation of solution

This is a fairly simple brute force approach to this problem.

First, we loop through the provided board until we find a letter that matches the first letter in the word. It will then call the findString function.

The findString function takes in four parameters:

  • board: the board we are testing
  • visited: the previous visited coordinates
  • coord: the current coordinate
  • word: the part of the word we are looking for

When we first enter this function it will check to see if we are searching for an empty word. If so, we have a valid solution.

If we have not found a valid solution yet, we add the current coordinate to the visited coordinates and recursively call this function on the four cardinal directions, first checking to see that:

  • The coordinate in that direction is a valid coordinate
  • The letter at the coordinate in that direction matches the next letter in the sequence
  • The coordinate in that direction has not yet been visited

If we have searched all cardinal directions and have not found a valid solution, we remove this coordinate from the visited coordinates and return false.

Running & Testing

To test this solution, simply add your boards and associated tests to the testCases array.

This was built and tested on Python 3.7.9, so please test with an appropriate version.

@AbelSAnderson AbelSAnderson changed the title Finished Solution Submission - Abel Anderson Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant