Twilio Quest
- https://www.twilio.com/quest
- TwilioQuest is an educational video game designed to teach a new generation of developers how to change the world with code.
- From learning how to use your terminal, to coding in Python, JavaScript, and contributing to Open Source projects, TwilioQuest will help you develop practical engineering skills.
import sys
Module
- In python, we can use module to import code which is made by others.
- From modules, we can make our program easier.
Sys
- Sys provides how to control python interpreter.
Formatting
- In python, we use
f
for string formatting.
- pop()
- Left variable gets last value of list.
- And List will lose last value.
- When you input an index in blank, left variable gets indexed value of list and list will lose the value.
Class
init(self)
- we use this for initializing and make instances.
def
- We can create our functions with
def
- You can also make function outside of a class and it’s not included in a class.
- But when we use
def
inside of a class, we should useself
too.
Boggle
- Boggle is a word game.
- Player find words in the board and player can link letters by up, down, left, rifht, even diagonal.
Code
Module
- I used nltk because it has
words()
function which get words in used.
Functions
- solve(board, dictionary)
- Limit max length of word. In this quest, our answer is 5 letters so our max length is equal or less than 5.
- check_the_combined_word(board, x, y, max_length, combined_word, green_ones, found)
- go to neighbor position in grid and add that letter in our combined word.
- neighbors(point, board)
- find neighbor position we can visit.
- not_visited(x, visited)
- ban letter to be used more than once.