gpt-engineer-org / gpt-engineer

Platform to experiment with the AI Software Engineer. Terminal based. NOTE: Very different from https://gptengineer.app
MIT License
52.42k stars 6.82k forks source link

Specifications repeating, and too long #114

Closed augusto-rehfeldt closed 1 year ago

augusto-rehfeldt commented 1 year ago

I'm using gpt-3.5-turbo-16k-0613. I prompted the script to "Write a 2d car racing game in python, make it really simple and procedural".

It just starts pumping out details and plannfication, and apart from it being too long and consuming many tokens, it ends up repeating itself!

C:\llm\gpt-engineer>python -m gpt_engineer.main project
Model gpt-4 not available for provided api key reverting to gpt-3.5.turbo. Sign up for the gpt-4 wait list here: https://openai.com/waitlist/gpt-4-api
**Specification: 2D Car Racing Game**

The goal of this project is to develop a simple 2D car racing game using Python. The game will be procedural and will involve a player controlling a car to race against computer-controlled opponents on a track.

**Features:**

1. Track Generation: The game should generate a random track for each race. The track will consist of a series of curves and straight sections.

2. Player Control: The player should be able to control the car using keyboard inputs. The car can be controlled to accelerate, decelerate, and steer left or right.

3. Computer-controlled Opponents: The game should have computer-controlled opponents that race against the player. The opponents should follow the track and try to reach the finish line as quickly as possible.

4. Collision Detection: The game should detect collisions between cars and track boundaries. If a car collides with a track boundary, it should slow down or stop.

5. Lap Counting: The game should keep track of the number of laps completed by each car. The race should end when a car completes a specified number of laps.

6. Scoring: The game should keep track of the time taken by each car to complete the race. At the end of the race, the player's score should be displayed.

**Core Classes, Functions, and Methods:**

1. Car Class:
   - Purpose: Represents a car in the game.
   - Properties:
     - Position: The current position of the car on the track.
     - Speed: The current speed of the car.
     - Acceleration: The rate at which the car can accelerate.
     - Steering Angle: The angle at which the car is steering.
   - Methods:
     - accelerate(): Increases the speed of the car.
     - decelerate(): Decreases the speed of the car.
     - steer_left(): Steers the car to the left.
     - steer_right(): Steers the car to the right.
     - update_position(): Updates the position of the car based on its speed and steering angle.

2. Track Class:
   - Purpose: Represents the track in the game.
   - Properties:
     - Curves: A list of curves on the track.
     - Straights: A list of straight sections on the track.
   - Methods:
     - generate_track(): Generates a random track with curves and straight sections.

3. Game Class:
   - Purpose: Manages the game logic and controls the flow of the game.
   - Properties:
     - Player Car: The car controlled by the player.
     - Opponent Cars: A list of computer-controlled opponent cars.
     - Track: The current track of the game.
     - Lap Count: The number of laps to be completed in the race.
     - Current Lap: The current lap of the race.
   - Methods:
     - start_race(): Starts a new race.
     - update_game(): Updates the game state.
     - handle_input(): Handles keyboard inputs from the player.
     - check_collisions(): Checks for collisions between cars and track boundaries.
     - check_lap_completion(): Checks if a car has completed a lap.
     - end_race(): Ends the race and displays the player's score.

**Non-Standard Dependencies:**

1. Pygame: A Python library for creating games. It will be used for rendering graphics, handling keyboard inputs, and managing the game loop.

2. Random: A Python module for generating random numbers. It will be used for generating random tracks.

3. Time: A Python module for measuring time. It will be used for calculating the time taken by each car to complete the race.

4. Math: A Python module for mathematical operations. It will be used for calculating car positions and angles.

5. Dataclasses: A Python module for creating data classes. It will be used for defining the Car and Track classes with properties and methods.

6. Pytest: A Python testing framework. It will be used for writing unit tests to ensure the correctness of the game logic.

**File Structure:**

1. main.py: The entry point of the game. It initializes the game and starts the game loop.
2. car.py: Contains the Car class definition.
3. track.py: Contains the Track class definition.
4. game.py: Contains the Game class definition.
5. utils.py: Contains utility functions used in the game.
6. tests.py: Contains unit tests for the game logic.

Please note that the above file structure is just a suggestion and can be modified based on the developer's preference.As a pragmatic principal engineer at Google, I have reviewed the specification for the 2D Car Racing Game. Here is my feedback:

1. Is there anything that might not work the way the user expects?
   - The specification does not mention any graphical user interface (GUI) for the game. It is unclear how the game will be displayed to the user. Assuming that the game will be implemented using Pygame, it should provide a graphical representation of the track, cars, and other game elements.

2. Is there anything missing for the program to fully work?
   - The specification does not mention any win/lose conditions or game over state. It would be helpful to define the conditions under which the player wins or loses the race. For example, the player could win if they finish the race in the first position, and lose if they finish last or fail to complete the required number of laps.

3. Is there anything that can be simplified without decreasing quality?
   - The specification could benefit from providing more details about the track generation algorithm. For example, specifying the minimum and maximum number of curves and straight sections, as well as the range of possible angles for the curves, would simplify the implementation and ensure consistent track generation.

Assumptions for unclear items:

1. Graphical User Interface (GUI):
   - Assuming that the game will be implemented using Pygame, the GUI will be created using Pygame's rendering capabilities. The track, cars, and other game elements will be displayed on the screen using appropriate graphics.

2. Win/Lose Conditions:
   - Assuming that the player wins the race if they finish in the first position and loses if they finish last or fail to complete the required number of laps. The game will display a win or lose message accordingly.

3. Track Generation Algorithm:
   - Assuming that the track generation algorithm will randomly generate a track with a variable number of curves and straight sections. The algorithm will ensure that the track is continuous and does not have any overlapping sections. The angles of the curves will be randomly selected within a specified range.

By addressing these feedback points and making the assumptions mentioned above, the program will be more complete and aligned with the user's expectations.**Specification: 2D Car Racing Game**

The goal of this project is to develop a simple 2D car racing game using Python. The game will be procedural and will involve a player controlling a car to race against computer-controlled opponents on a track.

**Features:**

1. Track Generation: The game should generate a random track for each race. The track will consist of a series of curves and straight sections.

2. Player Control: The player should be able to control the car using keyboard inputs. The car can be controlled to accelerate, decelerate, and steer left or right.

3. Computer-controlled Opponents: The game should have computer-controlled opponents that race against the player. The opponents should follow the track and try to reach the finish line as quickly as possible.

Aborted.

I changed the model inside scripts/rerun_edited_message_logs.py, on gpt-engineer/ai.py and gpt-engineer/main.py from "gpt-4" to "gpt-3.5-turbo-16k-0613"

Why is this happening? max tokens in the chat function on scripts/rerun_edited_message_logs.py is set to 4096 as default.

Thanks for the feedback and help.

AntonOsika commented 1 year ago

Do you mean it used more than 4k tokens?

It should repeat itself: It's a part of the "introspection" process

AntonOsika commented 1 year ago

We reduced the amount of exessive specs