Question: In Python with a VScode WSL terminal... please program an entire, working two - player game: the L game, invented by Edward de Bono. The

In Python with a VScode WSL terminal... please program an entire, working two-player game: the L game, invented by Edward de Bono. The game consists of a 4x4 grid, one 3x2 L-shaped piece for each player, and two 1x1 neutral pieces. The initial positions are specified. At each turn, a player must first move its L piece to a new position that is free (i.e., within the grid and not overlapping with the other L and the neutral pieces); and then may move one of the neutral pieces to any free position (or may choose not to move any neutral piece). The game finishes when a player cannot move its L piece to any position.
- Please follow these guidelines -
At a minimum, your program should do the following:
- Implement minimax and heuristic alpha-beta pruning (up to a user-provided depth d, possibly infinite).
- Implement a heuristic evaluation function.
- Define a representation for the states, legal actions and the result of applying a legal action to a state.
- Plot the board and pieces as the game progresses.
- Take as input from the keyboard a human move and print the computer move in the same format throughout the game (this is to make it possible to have one group's program play against another).
Note: you must represent this as in the following example: 12 E 4311 where (1,2) are the (x,y) coordinates of the corner of the L (where (1,1) is the top left grid position) and E is the orientation of the foot of the L (out of North, South, East, West); and a neutral piece is moved from (4,3) to (1,1). If not moving a neutral piece, omit the part 4311.
- Allow the user to provide an initial game state (different from the default one).
Note: you must represent this as in the following example (corresponding to the default initial state): 31 W 114424 E (L that moves first, the two neutral pieces, L that moves second).
- Allow the user to select who makes the first move (computer or human).
- Implement three versions: human vs human, human vs computer, computer vs computer.
- The implementation should be efficient, in particular regarding the use of appropriate data structures. Runtime needs to be good.
Please provide the entirety of the Python Code (Not AI generated please). No pseudo-code either, please give me the python code in full. The code should be able to be run using "python L-game.py"
The entirety of the code should just be one python file: L-game.py

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!