Comments

Log in with itch.io to leave a comment.

import random def preprocessText(text): text = text.lower() punctuation_marks = '.,!?;:"\'()[]{}' for char in punctuation_marks: text = text.replace(char, '') return text def createMarkovModel(text, order=3): model = {} words = text.split() for i in range(len(words) - order): prefix = tuple(words[i:i + order]) suffix = words[i + order] if prefix not in model: model[prefix] = [] model[prefix].append(suffix) # for understanding uncomment and run this part #print(f'{prefix} {suffix}\n') return model def generateText(model, length=50, seed=None): if seed is not None: random.seed(seed) current = random.choice(list(model.keys())) text = list(current) for _ in range(length): if current not in model: break next_word = random.choice(model[current]) text.append(next_word) current = tuple(text[-len(current):]) return ' '.join(text) sentence = "A sentence generator, using a Markov Chain, is good for understanding the fundamentals of Artificial Intelligence" newSentence = preprocessText(sentence) model = createMarkovModel(newSentence) generatedText = generateText(model, 50, 50) print(generatedText)

board = [0,1,2,3,4,5,6,7,8] def DrawBoard(): print() print(" | | ") print(f" {board[0]} | {board[1]} | {board[2]} ") print("_____|_____|_____") print(" | | ") print(f" {board[3]} | {board[4]} | {board[5]} ") print("_____|_____|_____") print(" | | ") print(f" {board[6]} | {board[7]} | {board[8]} ") print(" | | ") print() def GetWinner(): if board[0] == board[1] == board[2] or board[0] == board[4] == board[8] or board[0] == board[3] == board[6]: winner = board[0] elif board[1] == board[4] == board[7]: winner = board[1] elif board[2] == board[5] == board[8] or board[2] == board[4] == board[6]: winner = board[2] elif board[3] == board[4] == board[5]: winner = board[3] elif board[6] == board[7] == board[8]: winner = board[6] else: winner = "None" return winner playerOne = "◯" playerTwo = "✖"

import random words = ['bolt','nut','wrench','camera','loss','giraffe','contract','mud','effort','robotics'] secret_word = random.choice(words) print(secret_word) correct_guesses = [] incorrect_guesses = [] lives = 10 blank_spaces = '' for letter in secret_word: blank_spaces += '_ ' print(blank_spaces) ready = input('Are you ready to play? yes/no ').lower() while not ready == 'yes': ready = input('Are you ready to play? yes/no ').lower() while True: user_input = input("Guess one letter at a time or guess the entire word: ").lower() if user_input == secret_word: print('You got the whole thing!') correct_guesses += list(user_input) elif user_input in correct_guesses or user_input in incorrect_guesses: print('You already guessed that!') elif user_input in secret_word: print('Good guess!') correct_guesses += list(user_input) else: print('Nope, try again!') incorrect_guesses += list(user_input) lives -= 1

(+1)

3:48.40 current World Record holder.
Very fun game, much skill required. Death also has a cool house

(1 edit)

3:29;45 new World Record. Sorry.