liveBook · Manning

Player

As explained in Tiny Python Projects: Learn coding and testing with puzzles and games

A player is a participant in the tic-tac-toe game identified by a marker such as X or O.

A player is a tic-tac-toe participant represented by the marker X or O. The marker identifies who occupies each board cell and whose turn is being processed. section 21.1 section 22.1

A player participates in the game by:

  • Providing X or O alongside a selected cell to apply a move. section 21.1.2
  • Taking turns, with invalid moves leaving the current player unchanged. section 22.1
  • Appearing in the rendered board and winner announcement. section 22.1
if any([args.player, args.cell]) and not all([args.player, args.cell]):
   parser.error('Must provide both --player and --cell')

Require both the player marker and cell when applying a command-line move. section 21.2.1

A player takes a turn

The X player selects cell 1; the board displays X, and the prompt switches to O. Selecting occupied cell 1 again leaves O as the current player. section 22.1

How Tiny Python Projects: Learn coding and testing with puzzles and games covers it

How deep it goes
Defines X and O markers, validates player input, and applies markers to cells without developing player strategy.
Examples
Demonstrates X marking cell 1, alternating to O, rejecting occupied cells, and declaring an X winner.
What you can do after
Apply player markers via argparse and interactive prompts, validate moves, and update the board.
How it connects
Connects player with tic-tac-toe, board state, cells, command-line arguments, and input validation.

Also explained in

Compare how 2 books explain player →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Tiny Python Projects: Learn coding and testing with puzzles and games. The section links point to the parts of the book it draws on.