
Nov 11, 2022 54m
How do you create a pc opponent for a easy sport inside Python? Would you additionally wish to discover ways to adapt the sport to run in an online browser or graphical consumer interface (GUI)? This week on the present, Christopher Trudeau is right here, bringing one other batch of PyCoder’s Weekly articles and initiatives.
Episode Sponsor:
Christopher shares a latest Actual Python step-by-step challenge for making a tic-tac-toe sport engine. He talks about how one can construct the sport engine and adapt it for various entrance ends. The tutorial additionally reveals how one can implement an unbeatable pc participant utilizing the minimax algorithm.
We talk about an article about how one can keep away from repeating your self when creating decorators with a number of parameters. We discuss how one can cease copying and pasting code a number of occasions by assigning the decorator to a brand new variable.
We share a number of different articles and initiatives from the Python group, together with a information roundup, a deep dive into Python’s doctest, a number of Python command line tips, sort annotations by way of automated refactoring, a brand new manner to attract containers within the terminal, a group of initiatives for freshmen with supply code, a minimalist PDF creation library, and a device for smart logging in Python.
Course Highlight: Python Decorators 101
On this course on Python decorators, you’ll study what they’re and how one can create and use them. Decorators present a easy syntax for calling higher-order features in Python. By definition, a decorator is a perform that takes one other perform and extends the conduct of the latter perform with out explicitly modifying it.
Subjects:
- 00:00:00 – Introduction
- 00:02:25 – Python 3.12.0 Alpha 1 Launched
- 00:02:45 – PyCon US 2023 Name for Proposals
- 00:03:27 – Python’s doctest: Doc and Take a look at Your Code at As soon as
- 00:13:59 – Construct a Tic-Tac-Toe Sport Engine With an AI Participant in Python
- 00:22:12 – Sponsor: InfluxDB
- 00:22:59 – Python Command Line Tips
- 00:30:50 – Sort Annotation by way of Automated Refactoring
- 00:34:29 – A New (?) Method of Drawing Packing containers within the Terminal
- 00:37:10 – Decorator Shortcuts
- 00:39:36 – Video Course Highlight
- 00:41:02 – 190 Python Tasks With Supply Code
- 00:47:58 – fpdf2: Minimalist PDF Creation Library
- 00:50:04 – Easy, Sane, and Wise Logging in Python
- 00:53:05 – Thanks and goodbye
Information:
Subjects:
- Python’s doctest: Document and Test Your Code at Once – On this tutorial, you’ll discover ways to add utilization examples to your code’s documentation and docstrings and how one can use these examples to check your code. To run your utilization examples as automated assessments, you’ll use Python’s doctest module from the usual library.
- Build a Tic-Tac-Toe Game Engine With an AI Player in Python – On this step-by-step tutorial, you’ll construct a common sport engine in Python with tic-tac-toe guidelines and two pc gamers, together with an unbeatable AI participant utilizing the minimax algorithm. You’ll additionally create a text-based graphical entrance finish to your library and discover two different entrance ends.
- Python Command Line Tricks – Utilizing
python -m
you are able to do all types of issues from the command line, together with beginning a webserver, opening a browser, parsing JSON, compressing recordsdata, and way more. - Type Annotation via Automated Refactoring – Jimmy’s workforce at Carta determined they wished so as to add sort annotations to their massive codebase, however doing so manually would’ve taken a really very long time. This put up reveals you ways they constructed automated refactoring instruments so as to add sort annotations to their code.
- A New (?) Way of Drawing Boxes in the Terminal – With intelligent use of among the Unicode border characters, you possibly can construct a greater field round your textual content, with none coloration bleeding.
- Decorator Shortcuts – “When utilizing many decorators in code, there’s a shortcut you should utilize if you end up repeating them. They are often assigned to a variable identical to another Python expression.”
Dialogue:
Tasks:
Extra Hyperlinks:
Tweet
Share
Share
Email
class=”h4″>