Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 2.74 KB

README.md

File metadata and controls

36 lines (22 loc) · 2.74 KB

Python-Mini-Games

TIC-TAC-TOE

Quote from Wikipedia (Tic Tac Toe#Strategy)

A player can play a perfect game of Tic-tac-toe (to win or, at least, draw) if they choose the first available move from the following list, each turn, as used in Newell and Simon's 1972 tic-tac-toe program.[6]

Win: If you have two in a row, play the third to get three in a row. Block: If the opponent has two in a row, play the third to block them. Fork: Create an opportunity where you can win in two ways. Block Opponent's Fork:

Option 1: Create two in a row to force the opponent into defending, as long as it doesn't result in them creating a fork or winning. For example, if "X" has a corner, "O" has the center, and "X" has the opposite corner as well, "O" must not play a corner in order to win. (Playing a corner in this scenario creates a fork for "X" to win.)

Option 2: If there is a configuration where the opponent can fork, block that fork. Center: Play the center. Opposite Corner: If the opponent is in the corner, play the opposite corner. Empty Corner: Play an empty corner. Empty Side: Play an empty side.

HANGMAN-GAME

Quote from Wikipedia (Hangman (game)#Overview)

The word to guess is represented by a row of dashes, representing each letter of the word. In most variants, proper nouns, such as names, places, and brands, are not allowed. Slang words, sometimes referred to as informal or shortened words, are also not allowed. If the guessing player suggests a letter which occurs in the word, the other player writes it in all its correct positions. If the suggested letter does not occur in the word, the other player draws one element of a hanged man stick figure as a tally mark.

Quote from Wikipedia (Hangman (game)#Strategy)

The fact that the twelve most commonly occurring letters in the English language are e-t-a-o-i-n-s-h-r-d-l-u (from most to least), along with other letter-frequency lists, are used by the guessing player to increase the odds when it is their turn to guess. On the other hand, the same lists can be used by the puzzle setter to stump their opponent by choosing a word that deliberately avoids common letters (e.g. rhythm or zephyr) or one that contains rare letters (e.g. jazz).

SUDOKU-SOLVER

Quote from Wikipedia (Sudoku solving algorithms #Techniques #Backtracking)

Some hobbyists have developed computer programs that will solve Sudoku puzzles using a backtracking algorithm, which is a type of brute force search.[2] Backtracking is a depth-first search (in contrast to a breadth-first search), because it will completely explore one branch to a possible solution before moving to another branch. Although it has been established that approximately 5.96 x 1126 final grids exist, a brute force algorithm can be a practical method to solve Sudoku puzzles.