Featured Posts

CS50 Python , Nutrition Facts Table

Image
Nutrition Facts: Python Practice for Beginners Nutrition Facts Table for Python Practice Welcome to this comprehensive guide for Python beginners! If you are learning how to work with lists, dictionaries, and loops, this post will help you build practical skills using a real-world example: nutrition facts for fruits. Understanding how to organize and manipulate data is a key part of programming, and this exercise will give you hands-on experience. Below is a sample table of fruits and their calorie values, formatted as a Python list of dictionaries. This structure is ideal for coding exercises, projects, or even building your own nutrition calculator. You can expand this list, add new fruits, or use it as a foundation for more advanced Python tasks. Python List of Dictionaries Example: fruits = [ {'name': 'Apple', 'calories': 130}, {'name': 'Avocado', 'calories': 50}, {'name': 'Banana', 'ca...

Play Tic Tac Toe Game

Tic-Tac-Toe Game Challenge: Can You Beat the Machine?

Tic-Tac-Toe Game Challenge: Can You Beat the Machine?
tic-tac-toe

Welcome to the ultimate Tic-Tac-Toe challenge! Whether you are looking for a quick mental break or a serious battle against an unbeatable algorithm, you’ve come to the right place. This classic game, also known as "Noughts and Crosses," has been a favorite for generations, and now you can play it directly in your browser.

What is Tic-Tac-Toe?

Tic-Tac-Toe is a classic logic game played on a 3x3 grid. While it seems simple, it is actually a "zero-sum game" of perfect information. This means that if both players play perfectly, the game will always end in a draw. The challenge lies in spotting your opponent’s mistakes before they spot yours!

How to play tic-tac-toe game?

The rules are simple, making it the perfect game for all ages:

  1. The Grid: The game is played on a grid that's 3 squares by 3 squares.
  2. The Goal: You are X, and the computer is O. Players take turns putting their marks in empty squares.
  3. Winning: The first player to get 3 of their marks in a row (up, down, across, or diagonally) is the winner.
  4. The Draw: When all 9 squares are full, if no player has 3 marks in a row, the game is a tie.

Choose Your Difficulty Level

I have designed four different AI levels to test your skills:
  • Level 0 (The Novice): The computer is totally "dumb." it makes random moves. Great for a quick ego boost!
  • Level 1 (The Apprentice): A slightly smarter version that starts to recognize basic patterns.
  • Level 2 (The Tactician): The computer becomes much more strategic. You may win, but usually only if you make the first move and play perfectly.
  • Level 3 (The Grandmaster): The computer NEVER loses. It uses an optimized algorithm to ensure it either wins or forces a draw. Can you manage to at least get a tie?





level 0 -- the Computer is totally dumb.
level 1 -- Computer is smarter (original version).
level 2 -- You MAY win (only when you start).
level 3 -- Computer NEVER lose
.

Comments

Popular posts from this blog

فرصتك للدراسة في ألمانيا: منحة ممولة بالكامل لطلاب الدراسات العليا

How to Deactivate Screen Reader in Kali Linux

Murphy's Law: Expect the Unexpected

Python 3.2.1.14 LAB: Essentials of the while loop

Data Analysis Roadmap 2026: From Excel Lover to Python-Powered Analyst