forked from OpenBMB/ChatDev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
10,604 additions
and
614 deletions.
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
WareHouse/Gomoku_DefaultOrganization_20240125132710/ChatChainConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"chain": [{ | ||
"phase": "DemandAnalysis", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": -1, | ||
"need_reflect": "True" | ||
}, | ||
{ | ||
"phase": "LanguageChoose", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": -1, | ||
"need_reflect": "True" | ||
}, | ||
{ | ||
"phase": "Coding", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
}, | ||
{ | ||
"phase": "CodeCompleteAll", | ||
"phaseType": "ComposedPhase", | ||
"cycleNum": 10, | ||
"Composition": [{ | ||
"phase": "CodeComplete", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
}] | ||
}, | ||
{ | ||
"phase": "CodeReview", | ||
"phaseType": "ComposedPhase", | ||
"cycleNum": 3, | ||
"Composition": [{ | ||
"phase": "CodeReviewComment", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
}, | ||
{ | ||
"phase": "CodeReviewModification", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
} | ||
] | ||
}, | ||
{ | ||
"phase": "Test", | ||
"phaseType": "ComposedPhase", | ||
"cycleNum": 3, | ||
"Composition": [{ | ||
"phase": "TestErrorSummary", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
}, | ||
{ | ||
"phase": "TestModification", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
} | ||
] | ||
}, | ||
{ | ||
"phase": "EnvironmentDoc", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "True" | ||
}, | ||
{ | ||
"phase": "Manual", | ||
"phaseType": "SimplePhase", | ||
"max_turn_step": 1, | ||
"need_reflect": "False" | ||
} | ||
], | ||
"recruitments": [ | ||
"Chief Executive Officer", | ||
"Counselor", | ||
"Chief Human Resource Officer", | ||
"Chief Product Officer", | ||
"Chief Technology Officer", | ||
"Programmer", | ||
"Code Reviewer", | ||
"Software Test Engineer", | ||
"Chief Creative Officer" | ||
], | ||
"clear_structure": "True", | ||
"gui_design": "True", | ||
"git_management": "False", | ||
"web_spider": "False", | ||
"self_improve": "False", | ||
"incremental_develop": "False", | ||
"with_memory": "True", | ||
"background_prompt": "ChatDev is a software company powered by multiple intelligent agents, such as chief executive officer, chief human resources officer, chief product officer, chief technology officer, etc, with a multi-agent organizational structure and the mission of 'changing the digital world through programming'." | ||
} |
1 change: 1 addition & 0 deletions
1
WareHouse/Gomoku_DefaultOrganization_20240125132710/Gomoku.prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Develop a basic Gomoku game. |
4,514 changes: 4,514 additions & 0 deletions
4,514
...e/Gomoku_DefaultOrganization_20240125132710/Gomoku_DefaultOrganization_20240125132710.log
Large diffs are not rendered by default.
Oops, something went wrong.
278 changes: 278 additions & 0 deletions
278
WareHouse/Gomoku_DefaultOrganization_20240125132710/PhaseConfig.json
Large diffs are not rendered by default.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
WareHouse/Gomoku_DefaultOrganization_20240125132710/RoleConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"Chief Executive Officer": [ | ||
"{chatdev_prompt}", | ||
"You are Chief Executive Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"Your main responsibilities include being an active decision-maker on users' demands and other key policy issues, leader, manager, and executor. Your decision-making role involves high-level decisions about policy and strategy; and your communicator role can involve speaking to the organization's management and employees.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs." | ||
], | ||
"Chief Product Officer": [ | ||
"{chatdev_prompt}", | ||
"You are Chief Product Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You are responsible for all product-related matters in ChatDev. Usually includes product design, product strategy, product vision, product innovation, project management and product marketing.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
], | ||
"Counselor": [ | ||
"{chatdev_prompt}", | ||
"You are Counselor. Now, we share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"Your main responsibilities include asking what user and customer think and provide your valuable suggestions. ", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs." | ||
], | ||
"Chief Technology Officer": [ | ||
"{chatdev_prompt}", | ||
"You are Chief Technology Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You are very familiar to information technology. You will make high-level decisions for the overarching technology infrastructure that closely align with the organization's goals, while you work alongside the organization's information technology (\"IT\") staff members to perform everyday operations.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, You must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
], | ||
"Chief Human Resource Officer": [ | ||
"{chatdev_prompt}", | ||
"You are Chief Human Resource Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You are a corporate officer who oversees all aspects of human resource management and industrial relations policies, practices and operations for an organization. You will be involved in board staff recruitment, member selection, executive compensation, and succession planning. Besides, You report directly to the chief executive officer (CEO) and am a member of the most senior-level committees of a company (e.g., executive committee or office of CEO).", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
], | ||
"Programmer": [ | ||
"{chatdev_prompt}", | ||
"You are Programmer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You can write/create computer software or applications by providing a specific programming language to the computer. You have extensive computing and coding experience in many varieties of programming languages and platforms, such as Python, Java, C, C++, HTML, CSS, JavaScript, XML, SQL, PHP, etc,.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
], | ||
"Code Reviewer": [ | ||
"{chatdev_prompt}", | ||
"You are Code Reviewer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You can help programmers to assess source codes for software troubleshooting, fix bugs to increase code quality and robustness, and offer proposals to improve the source codes.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
], | ||
"Software Test Engineer": [ | ||
"{chatdev_prompt}", | ||
"You are Software Test Engineer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You can use the software as intended to analyze its functional properties, design manual and automated test procedures to evaluate each software product, build and implement software evaluation test programs, and run test programs to ensure that testing protocols evaluate the software correctly.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
], | ||
"Chief Creative Officer": [ | ||
"{chatdev_prompt}", | ||
"You are Chief Creative Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer.", | ||
"You direct ChatDev's creative software's and develop the artistic design strategy that defines the company's brand. You create the unique image or music of our produced software's and deliver this distinctive design to consumers to create a clear brand image which is a fundamental and essential work throughout the company.", | ||
"Here is a new customer's task: {task}.", | ||
"To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs." | ||
] | ||
} |
71 changes: 71 additions & 0 deletions
71
WareHouse/Gomoku_DefaultOrganization_20240125132710/game.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
''' | ||
This file contains the Game class for the Gomoku game. | ||
''' | ||
class Game: | ||
def __init__(self): | ||
self.board_size = 15 | ||
self.board = [[0] * self.board_size for _ in range(self.board_size)] | ||
self.current_player = 1 | ||
def make_move(self, row, col): | ||
if self.board[row][col] == 0: | ||
self.board[row][col] = self.current_player | ||
self.current_player = 3 - self.current_player | ||
def check_winner(self): | ||
for row in range(self.board_size): | ||
for col in range(self.board_size): | ||
if self.board[row][col] != 0: | ||
if self.check_horizontal(row, col) or self.check_vertical(row, col) or self.check_diagonal(row, col): | ||
return self.board[row][col] | ||
return 0 | ||
def check_horizontal(self, row, col): | ||
count = 1 | ||
for i in range(1, 5): | ||
if col + i < self.board_size and self.board[row][col + i] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
for i in range(1, 5): | ||
if col - i >= 0 and self.board[row][col - i] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
return count >= 5 | ||
def check_vertical(self, row, col): | ||
count = 1 | ||
for i in range(1, 5): | ||
if row + i < self.board_size and self.board[row + i][col] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
for i in range(1, 5): | ||
if row - i >= 0 and self.board[row - i][col] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
return count >= 5 | ||
def check_diagonal(self, row, col): | ||
count = 1 | ||
for i in range(1, 5): | ||
if row + i < self.board_size and col + i < self.board_size and self.board[row + i][col + i] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
for i in range(1, 5): | ||
if row - i >= 0 and col - i >= 0 and self.board[row - i][col - i] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
if count > 5: | ||
return True | ||
count = 1 | ||
for i in range(1, 5): | ||
if row + i < self.board_size and col - i >= 0 and self.board[row + i][col - i] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
for i in range(1, 5): | ||
if row - i >= 0 and col + i < self.board_size and self.board[row - i][col + i] == self.board[row][col]: | ||
count += 1 | ||
else: | ||
break | ||
return count > 5 |
47 changes: 47 additions & 0 deletions
47
WareHouse/Gomoku_DefaultOrganization_20240125132710/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
''' | ||
This is the main file for the Gomoku game. | ||
''' | ||
import tkinter as tk | ||
from game import Game | ||
class GomokuApp: | ||
def __init__(self, master): | ||
self.master = master | ||
self.game = Game() | ||
self.board_size = 15 | ||
self.cell_size = 40 | ||
self.canvas_width = self.board_size * self.cell_size | ||
self.canvas_height = self.board_size * self.cell_size | ||
self.canvas = tk.Canvas(self.master, width=self.canvas_width, height=self.canvas_height) | ||
self.canvas.pack() | ||
self.canvas.bind("<Button-1>", self.on_click) | ||
self.draw_board() | ||
def draw_board(self): | ||
for i in range(self.board_size): | ||
self.canvas.create_line(i * self.cell_size, 0, i * self.cell_size, self.canvas_height) | ||
self.canvas.create_line(0, i * self.cell_size, self.canvas_width, i * self.cell_size) | ||
def on_click(self, event): | ||
row = event.y // self.cell_size | ||
col = event.x // self.cell_size | ||
self.game.make_move(row, col) | ||
self.draw_piece(row, col) | ||
winner = self.game.check_winner() | ||
if winner != 0: | ||
self.show_winner(winner) | ||
def draw_piece(self, row, col): | ||
x = col * self.cell_size | ||
y = row * self.cell_size | ||
if self.game.current_player == 1: | ||
color = "black" | ||
else: | ||
color = "white" | ||
self.canvas.create_oval(x, y, x + self.cell_size, y + self.cell_size, fill=color) | ||
def show_winner(self, winner): | ||
if winner == 1: | ||
message = "Black wins!" | ||
else: | ||
message = "White wins!" | ||
self.canvas.create_text(self.canvas_width // 2, self.canvas_height // 2, text=message, font=("Arial", 20)) | ||
if __name__ == "__main__": | ||
root = tk.Tk() | ||
app = GomokuApp(root) | ||
root.mainloop() |
64 changes: 64 additions & 0 deletions
64
WareHouse/Gomoku_DefaultOrganization_20240125132710/manual.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Gomoku Game User Manual | ||
|
||
Welcome to the Gomoku game! This user manual will guide you through the installation process and explain how to play the game. | ||
|
||
## Table of Contents | ||
1. [Installation](#installation) | ||
2. [Game Rules](#game-rules) | ||
3. [How to Play](#how-to-play) | ||
4. [Game Controls](#game-controls) | ||
5. [Ending the Game](#ending-the-game) | ||
|
||
## Installation <a name="installation"></a> | ||
|
||
To install and run the Gomoku game, please follow these steps: | ||
|
||
1. Make sure you have Python installed on your computer. You can download Python from the official website: [https://www.python.org/downloads/](https://www.python.org/downloads/) | ||
|
||
2. Open a terminal or command prompt. | ||
|
||
3. Navigate to the directory where you have saved the `main.py` and `game.py` files. | ||
|
||
4. Run the following command to install the required dependencies: | ||
|
||
``` | ||
pip install tkinter | ||
``` | ||
|
||
5. Once the installation is complete, you can start the game by running the following command: | ||
|
||
``` | ||
python main.py | ||
``` | ||
|
||
The game window will open, and you can start playing! | ||
|
||
## Game Rules <a name="game-rules"></a> | ||
|
||
Gomoku is a strategy board game played on a 15x15 grid. The objective of the game is to be the first player to get five of their pieces in a row, either horizontally, vertically, or diagonally. | ||
|
||
The game is played by two players, Black and White, who take turns placing their pieces on the board. Black always goes first. | ||
|
||
## How to Play <a name="how-to-play"></a> | ||
|
||
1. When the game window opens, you will see a 15x15 grid representing the game board. | ||
|
||
2. To make a move, click on an empty cell on the board. The cell will be filled with your piece (Black or White). | ||
|
||
3. The game will automatically switch turns between Black and White after each move. | ||
|
||
4. The first player to get five of their pieces in a row wins the game. If the board is filled and no player has won, the game is a draw. | ||
|
||
## Game Controls <a name="game-controls"></a> | ||
|
||
The game controls are simple: | ||
|
||
- Left-click: Place a piece on the board. | ||
|
||
## Ending the Game <a name="ending-the-game"></a> | ||
|
||
The game will automatically end when one player wins by getting five of their pieces in a row, or when the board is filled and no player has won. | ||
|
||
To play again, simply close the game window and run the `main.py` file again. | ||
|
||
Enjoy playing Gomoku! |
33 changes: 33 additions & 0 deletions
33
WareHouse/Gomoku_DefaultOrganization_20240125132710/meta.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Task: | ||
Develop a basic Gomoku game. | ||
|
||
Config: | ||
ChatEnvConfig.with_memory: True | ||
ChatEnvConfig.clear_structure: True | ||
ChatEnvConfig.git_management: False | ||
ChatEnvConfig.gui_design: True | ||
ChatEnvConfig.incremental_develop: False | ||
ChatEnvConfig.background_prompt: ChatDev is a software company powered by multiple intelligent agents, such as chief executive officer, chief human resources officer, chief product officer, chief technology officer, etc, with a multi-agent organizational structure and the mission of 'changing the digital world through programming'. | ||
|
||
|
||
Roster: | ||
Chief Executive Officer, Counselor, Chief Human Resource Officer, Chief Product Officer, Chief Technology Officer, Programmer, Code Reviewer, Software Test Engineer, Chief Creative Officer | ||
|
||
Modality: | ||
application | ||
|
||
Ideas: | ||
|
||
|
||
Language: | ||
Python | ||
|
||
Code_Version: | ||
4.0 | ||
|
||
Proposed_images: | ||
0 | ||
|
||
Incorporated_images: | ||
0 | ||
|
Oops, something went wrong.