Use different orders of N-gram model to play Hangman game.

Overview

Hangman game

The Hangman game is a game whereby one person thinks of a word, which is kept secret from another person, who tries to guess the word one character at a time. The game ends when the guessesing count achieve more than a fixed number (8 in general) of incorrect guesses, or the secret word is guessed.

The aim of this repo is to apply a language model, N-gram model, to guess the secret word automatically. Besides, an automatic player needs to make the guessing count as few as possible. The ultimate goal is to be less than 8 since it means that the AI player will not lose the game.

To build the model for N-gram, I used Brown corpus in NLTK. In my implementation, there are random guessesing method (for fun), unigram model, bigram model, and trigram model with smoothing method. Among them, the last method has the least average number (8.102) of guesses. The detail of the implementation are all in notebook.

Importance

This is a assignment from a NLP course (subject). If you come to watch because of your course (subject) assignment, DO NOT just copy and paste this code or just modify the variables names. Otherwise, your score is possible to be penalised. Moreover, The goal of this project is to build and critically analyse some supervised Machine Learning algorithms. Therefore, in this repository, I just tried to implement multiple models to compare their performances. There is no guarantee that these models are the best.

Source

University of Melbourne COMP90042 Subject.

You might also like...
A Gomoku game GUI using pygame where the user can choose to play against another player or an AI using minimax with alpha-beta pruning

Gomoku A GUI based Gomoku game using pygame where the user can choose to play against another player or an AI using minimax with alpha-beta pruning. R

An automation bot to play Myuu Discord game
An automation bot to play Myuu Discord game

Auto selfbot Myuu is a self Discordbot, meaning it will use your TOKEN to logged as your account and take commands from yourself to play the game.

A python-based multi-player online educational game for students to play in a class or club setting.
A python-based multi-player online educational game for students to play in a class or club setting.

Kurono (codename: aimmo) Code for Life has been developed by Ocado Technology as a free, open-source project to inspire the next generation of compute

Easy and fun game to play a bit. Written in python
Easy and fun game to play a bit. Written in python

NumGuesser Easy and fun game to play a bit. Written in python

TetrisAI - Tetris AI Bot using computer vision to play game automatically
TetrisAI - Tetris AI Bot using computer vision to play game automatically

Tetris AI Tetris AI Bot using computer vision to play game automatically bot.py

View your VALORANT performance in different areas of every map in the game!
View your VALORANT performance in different areas of every map in the game!

Valorant-Zone-Stats Inspired by Leetify's awesome Map Zones Tool for CS:GO A simple desktop program to view your VALORANT performance in different are

Parkour game made in Python with Ursina Game Engine along with ano0002, Greeny127 and Someone-github Snake game mixed with Conway's Game of Life
Snake game mixed with Conway's Game of Life

SnakeOfLife Snake game mixed with Conway's Game of Life The rules are the same than a normal snake game but you have to avoid cells created by Conway'

Lint game data metafiles against GTA5.xsd for Rockstar's game engine (RAGE)
Lint game data metafiles against GTA5.xsd for Rockstar's game engine (RAGE)

rage-lint Lint RAGE (only GTA5 at the moment) meta/XML files for validity based off of the GTA5.xsd generated from game code. This script accepts a se

Owner
ZavierYang
Master IT student the University of Melbourne
ZavierYang
A simple hangman game for beginners trying to learn python

Hangman Game This is a simple hangman game for beginners trying to learn python. I have tried to keep it as simply as possible. Sample output Here is

null 1 Oct 13, 2021
This Country Hangman game written in Python.

country-name-guess-hangman-game This Country Hangman game written in Python. Visit https://example.com to play the game. Description How to play this

Aytaç Kaşoğlu 1 Oct 30, 2021
Create a Hangman Game using Python and all techniques of Python.

Hangman Game Created by Fernando Callasaca Game rules: Choose a word and if you guess it will appear completed. In case it is not the word then the ma

Fernando Callasaca 3 Nov 1, 2021
Hangman Game

Hangman Game Este juego fue creado a partir de los conocimientos adquiridos en el Curso de Python: Comprehensions, Lambdas y Manejo de Errores que exi

Carlos Valencia 2 Nov 14, 2022
A hangman game that I created. Thanks to Data Flair for giving me the code!

Hangman A hangman game that I created. Thanks to Data Flair for giving me the code! Run python3 hangman.py in a terminal if you have Python 3. Please

SmashedFrenzy16 0 Dec 24, 2022
Command-line Hangman game

Hang-_an-game-python-build Hangman C command-line Hangman game. Compilation Navigate to the root of the repository from your Terminal and run make to

Hemant Choudhary 3 Jan 16, 2022
Play a game of Phazed with a bot or with other players or watch bots play with each other

Phazed Game and Player play a game of Phazed with a bot or with other players or watch bots play with each other Live Demo hosted on repl.it (makes su

Xin Yu 0 Aug 28, 2021
Deliver buycraft orders to players across the map in minecraft servers using baritone

Deliver buycraft orders to players across the map in minecraft servers using baritone

synthels 1 Nov 14, 2021
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022
Bingo game now in python play as much you want :) no need to give me credit it's open as fuck

Bingo-py-game A game coded with Python Introduction This is a Terminal-based game currently in its initial stage. I am working on adding more efficien

Frey 5 Aug 12, 2021