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

My solution submission #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

My solution submission #1

wants to merge 2 commits into from

Conversation

njonah
Copy link

@njonah njonah commented Nov 21, 2022

CS Games 2023 Team A Application

PLEASE FILL IN THE FOLLOWING!

Full Name

Nathan Jonah

UWindsor Email

[email protected]

Application Form

Briefly explain how your solution works and how to run it

This solution first iterates through each element in every row and column, checking to see if there is a match between the first letter of the goal word. If there is a match with the first letter, the program explores the possible pathways in the array of up, down, left and right and sees if there is a way to create the word by following along these pathways. It does this by keeping track of the moves and validating each move. If a dead end is reached, block the original first step of the path and search along the other pathways. If all possible paths from the start are exhausted, and no solution is reached, the program returns false for that first letter and looks for another first letter of the word again. If the entire array is gone through without finding the word, the function returns false.

To run this program, it should be possible to download the python file and use it with the python3 on your system. If you want to test against your test functions, first create a solution
image
then use (solutionname).canconstword(board,word) which will return true or false if the word can be constructed in the array.

This program was made assuming the edge case of a word with 0 characters is not inputted.

remove print on line 108 if needed for running on your cases
@njonah
Copy link
Author

njonah commented Nov 21, 2022

image
Added command line input to program, input is entered as below after running python3 solution.py

A B C E
S F C S
A D E E
ABFSAD

After entering the input, the program will print True or False, depending on if a word can be created.
image
The function that returns true or false is again (solutionname).canconstword(board,word)
image

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