modification for wikis

This commit is contained in:
NA-Wen 2024-01-25 13:43:29 +08:00
parent 9a40484ae6
commit 65acdc9249
38 changed files with 10604 additions and 614 deletions

View File

@ -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'."
}

View File

@ -0,0 +1 @@
Develop a basic Gomoku game.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,278 @@
{
"DemandAnalysis": {
"assistant_role_name": "Chief Product Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"ChatDev has made products in the following form before:",
"Image: can present information in line chart, bar chart, flow chart, cloud chart, Gantt chart, etc.",
"Document: can present information via .docx files.",
"PowerPoint: can present information via .pptx files.",
"Excel: can present information via .xlsx files.",
"PDF: can present information via .pdf files.",
"Website: can present personal resume, tutorial, products, or ideas, via .html files.",
"Application: can implement visualized game, software, tool, etc, via python.",
"Dashboard: can display a panel visualizing real-time information.",
"Mind Map: can represent ideas, with related concepts arranged around a core concept.",
"As the {assistant_role}, to satisfy the new user's demand and the product should be realizable, you should keep discussing with me to decide which product modality do we want the product to be?",
"Note that we must ONLY discuss the product modality and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion by replying with only one line, which starts with a single word <INFO>, followed by our final product modality without any other words, e.g., \"<INFO> PowerPoint\"."
]
},
"LanguageChoose": {
"assistant_role_name": "Chief Technology Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"According to the new user's task and some creative brainstorm ideas listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Ideas: \"{ideas}\".",
"We have decided to complete the task through a executable software implemented via a programming language. ",
"As the {assistant_role}, to satisfy the new user's demand and make the software realizable, you should propose a concrete programming language. If python can complete this task via Python, please answer Python; otherwise, answer another programming language (e.g., Java, C++, etc,).",
"Note that we must ONLY discuss the target programming language and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion and conclude the best programming language we have discussed without any other words or reasons, return only one line using the format: \"<INFO> *\" where \"*\" represents a programming language."
]
},
"Coding": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"According to the new user's task and our software designs listed below: ",
"Task: \"{task}\".",
"Task description: \"{description}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas:\"{ideas}\"",
"We have decided to complete the task through a executable software with multiple files implemented via {language}. As the {assistant_role}, to satisfy the new user's demands, you should write one or multiple files and make sure that every detail of the architecture is, in the end, implemented as code. {gui}",
"Think step by step and reason yourself to the right decisions to make sure we get it right.",
"You will first lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose.",
"Then you will output the content of each file including complete code. Each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"You will start with the \"main\" file, then go to the ones that are imported by that file, and so on.",
"Please note that the code should be fully functional. Ensure to implement all functions. No placeholders (such as 'pass' in Python)."
]
},
"ArtDesign": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Creative Officer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Task: \"{task}\".",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and equip the software with a beautiful graphical user interface (GUI), we will discuss and design many decorative images for GUI decoration. Now, we keep discussing the GUI beautification by listing some functionally independent elements in GUI that are being considered to be decorated by different pictures. For example, ten digits (0-9) in a calculator are functionally independent.",
"To answer, use the format: \" FILENAME.png: DESCRIPTION\" where \"FILENAME\" is the filename of the image and \"DESCRIPTION\" denotes the detailed description of the independent elements. For example:",
"'''",
"button_1.png: The button with the number \"1\" on it.",
"button_multiply.png: The button with the multiplication symbol (\"*\") on it.",
"background.png: the background color to decorate the Go game",
"'''",
"Now, list all functionally independent elements as much as possible."
]
},
"ArtIntegration": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Creative Officer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Task: \"{task}\".",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and equip the software with a beautiful graphical user interface (GUI), you will incorporate our designed images for GUI decoration. Here are some ready-made high-quality pictures and corresponding descriptions:",
"{images}",
"Note that the designed images have a fixed size of 256x256 pixels and the images are located in the same directory as all the Python files; please dynamically scaling these images according to the size of GUI, and use \"self.*\" to avoid displaying-related problems caused by automatic garbage collection. For example:",
"```",
"self.image = ImageTk.PhotoImage(Image.open(\"./image.png\").resize((50, 50)))",
"```",
"Now, use some or all of the pictures into the GUI to make it more beautiful and creative. Output codes strictly following the required format mentioned above."
]
},
"CodeComplete": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"According to the new user's task and our software designs listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Codes:",
"\"{codes}\"",
"Unimplemented File:",
"\"{unimplemented_file}\"",
"In our software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the complete function of our developed software, you have to implement all methods in the {unimplemented_file} file which contains a unimplemented class. Now, implement all methods of the {unimplemented_file} and all other codes needed, then output the fully implemented codes, strictly following the required format."
]
},
"CodeReviewComment": {
"assistant_role_name": "Code Reviewer",
"user_role_name": "Programmer",
"phase_prompt": [
"According to the new user's task and our software designs: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes:",
"\"{codes}\"",
"As the {assistant_role}, to make the software directly operable without further coding, ChatDev have formulated the following regulations:",
"1) all referenced classes should be imported;",
"2) all methods should be implemented;",
"3) all methods need to have the necessary comments;",
"4) no potential bugs;",
"5) The entire project conforms to the tasks proposed by the user;",
"6) most importantly, do not only check the errors in the code, but also the logic of code. Make sure that user can interact with generated software without losing any feature in the requirement;",
"Now, you should check the above regulations one by one and review the codes in detail, propose one comment with the highest priority about the codes, and give me instructions on how to fix. Tell me your comment with the highest priority and corresponding suggestions on revision. If the codes are perfect and you have no comment on them, return only one line like \"<INFO> Finished\"."
]
},
"CodeReviewModification": {
"assistant_role_name": "Programmer",
"user_role_name": "Code Reviewer",
"phase_prompt": [
"According to the new user's task, our designed product modality, languages and ideas, our developed first-edition source codes are listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"Comments on Codes:",
"\"{comments}\"",
"In the software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code. Format:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and make the software creative, executive and robust, you should modify corresponding codes according to the comments. Then, output the full and complete codes with all bugs fixed based on the comments. Return all codes strictly following the required format."
]
},
"TestErrorSummary": {
"assistant_role_name": "Programmer",
"user_role_name": "Software Test Engineer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Test Reports of Source Codes:",
"\"{test_reports}\"",
"According to my test reports, please locate and summarize the bugs that cause the problem."
]
},
"TestModification": {
"assistant_role_name": "Programmer",
"user_role_name": "Software Test Engineer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Test Reports of Source Codes:",
"\"{test_reports}\"",
"Error Summary of Test Reports:",
"\"{error_summary}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and make the software execute smoothly and robustly, you should modify the codes based on the error summary. Now, use the format exemplified above and modify the problematic codes based on the error summary. Output the codes that you fixed based on the test reported and corresponding explanations (strictly follow the format defined above, including FILENAME, LANGUAGE, DOCSTRING and CODE; incomplete \"TODO\" codes are strictly prohibited). If no bugs are reported, please return only one line like \"<INFO> Finished\"."
]
},
"EnvironmentDoc": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"The new user's task and our developed codes are listed: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"As the {assistant_role}, you should write a requirements.txt file, which is commonly used in Python projects to specify the dependencies or packages required for the project to run properly. It serves as a way to document and manage the project's dependencies in a standardized format. For example:",
"requirements.txt",
"```",
"numpy==1.19.2",
"pandas>=1.1.4",
"```",
"According to the codes and file format listed above, write a requirements.txt file to specify the dependencies or packages required for the project to run properly."
]
},
"Manual": {
"assistant_role_name": "Chief Product Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"The new user's task, our developed codes and required dependencies are listed: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"Requirements:",
"\"{requirements}\"",
"As the {assistant_role}, by using Markdown, you should write a manual.md file which is a detailed user manual to use the software, including introducing main functions of the software, how to install environment dependencies and how to use/play it. For example:",
"manual.md",
"```",
"# LangChain",
"Building applications with LLMs through composability",
"Looking for the JS/TS version? Check out LangChain.js.",
"**Production Support:** As you move your LangChains into production, we'd love to offer more comprehensive support.",
"Please fill out this form and we'll set up a dedicated support Slack channel.",
"## Quick Install",
"`pip install langchain`",
"or",
"`conda install langchain -c conda-forge`",
"## 🤔 What is this?",
"Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. However, using these LLMs in isolation is often insufficient for creating a truly powerful app - the real power comes when you can combine them with other sources of computation or knowledge.",
"This library aims to assist in the development of those types of applications. Common examples of these applications include:",
"**❓ Question Answering over specific documents**",
"- Documentation",
"- End-to-end Example: Question Answering over Notion Database",
"**🤖 Agents**",
"- Documentation",
"- End-to-end Example: GPT+WolframAlpha",
"## 📖 Documentation",
"Please see [here](https://python.langchain.com) for full documentation on:",
"- Getting started (installation, setting up the environment, simple examples)",
"- How-To examples (demos, integrations, helper functions)",
"- Reference (full API docs)",
"- Resources (high-level explanation of core concepts)",
"```"
]
}
}

View File

@ -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."
]
}

View File

@ -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

View File

@ -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()

View File

@ -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!

View File

@ -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

View File

@ -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": "False",
"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'."
}

View File

@ -0,0 +1 @@
Develop a basic Gomoku game.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,278 @@
{
"DemandAnalysis": {
"assistant_role_name": "Chief Product Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"ChatDev has made products in the following form before:",
"Image: can present information in line chart, bar chart, flow chart, cloud chart, Gantt chart, etc.",
"Document: can present information via .docx files.",
"PowerPoint: can present information via .pptx files.",
"Excel: can present information via .xlsx files.",
"PDF: can present information via .pdf files.",
"Website: can present personal resume, tutorial, products, or ideas, via .html files.",
"Application: can implement visualized game, software, tool, etc, via python.",
"Dashboard: can display a panel visualizing real-time information.",
"Mind Map: can represent ideas, with related concepts arranged around a core concept.",
"As the {assistant_role}, to satisfy the new user's demand and the product should be realizable, you should keep discussing with me to decide which product modality do we want the product to be?",
"Note that we must ONLY discuss the product modality and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion by replying with only one line, which starts with a single word <INFO>, followed by our final product modality without any other words, e.g., \"<INFO> PowerPoint\"."
]
},
"LanguageChoose": {
"assistant_role_name": "Chief Technology Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"According to the new user's task and some creative brainstorm ideas listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Ideas: \"{ideas}\".",
"We have decided to complete the task through a executable software implemented via a programming language. ",
"As the {assistant_role}, to satisfy the new user's demand and make the software realizable, you should propose a concrete programming language. If python can complete this task via Python, please answer Python; otherwise, answer another programming language (e.g., Java, C++, etc,).",
"Note that we must ONLY discuss the target programming language and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion and conclude the best programming language we have discussed without any other words or reasons, return only one line using the format: \"<INFO> *\" where \"*\" represents a programming language."
]
},
"Coding": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"According to the new user's task and our software designs listed below: ",
"Task: \"{task}\".",
"Task description: \"{description}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas:\"{ideas}\"",
"We have decided to complete the task through a executable software with multiple files implemented via {language}. As the {assistant_role}, to satisfy the new user's demands, you should write one or multiple files and make sure that every detail of the architecture is, in the end, implemented as code. {gui}",
"Think step by step and reason yourself to the right decisions to make sure we get it right.",
"You will first lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose.",
"Then you will output the content of each file including complete code. Each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"You will start with the \"main\" file, then go to the ones that are imported by that file, and so on.",
"Please note that the code should be fully functional. Ensure to implement all functions. No placeholders (such as 'pass' in Python)."
]
},
"ArtDesign": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Creative Officer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Task: \"{task}\".",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and equip the software with a beautiful graphical user interface (GUI), we will discuss and design many decorative images for GUI decoration. Now, we keep discussing the GUI beautification by listing some functionally independent elements in GUI that are being considered to be decorated by different pictures. For example, ten digits (0-9) in a calculator are functionally independent.",
"To answer, use the format: \" FILENAME.png: DESCRIPTION\" where \"FILENAME\" is the filename of the image and \"DESCRIPTION\" denotes the detailed description of the independent elements. For example:",
"'''",
"button_1.png: The button with the number \"1\" on it.",
"button_multiply.png: The button with the multiplication symbol (\"*\") on it.",
"background.png: the background color to decorate the Go game",
"'''",
"Now, list all functionally independent elements as much as possible."
]
},
"ArtIntegration": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Creative Officer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Task: \"{task}\".",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and equip the software with a beautiful graphical user interface (GUI), you will incorporate our designed images for GUI decoration. Here are some ready-made high-quality pictures and corresponding descriptions:",
"{images}",
"Note that the designed images have a fixed size of 256x256 pixels and the images are located in the same directory as all the Python files; please dynamically scaling these images according to the size of GUI, and use \"self.*\" to avoid displaying-related problems caused by automatic garbage collection. For example:",
"```",
"self.image = ImageTk.PhotoImage(Image.open(\"./image.png\").resize((50, 50)))",
"```",
"Now, use some or all of the pictures into the GUI to make it more beautiful and creative. Output codes strictly following the required format mentioned above."
]
},
"CodeComplete": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"According to the new user's task and our software designs listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Codes:",
"\"{codes}\"",
"Unimplemented File:",
"\"{unimplemented_file}\"",
"In our software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the complete function of our developed software, you have to implement all methods in the {unimplemented_file} file which contains a unimplemented class. Now, implement all methods of the {unimplemented_file} and all other codes needed, then output the fully implemented codes, strictly following the required format."
]
},
"CodeReviewComment": {
"assistant_role_name": "Code Reviewer",
"user_role_name": "Programmer",
"phase_prompt": [
"According to the new user's task and our software designs: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes:",
"\"{codes}\"",
"As the {assistant_role}, to make the software directly operable without further coding, ChatDev have formulated the following regulations:",
"1) all referenced classes should be imported;",
"2) all methods should be implemented;",
"3) all methods need to have the necessary comments;",
"4) no potential bugs;",
"5) The entire project conforms to the tasks proposed by the user;",
"6) most importantly, do not only check the errors in the code, but also the logic of code. Make sure that user can interact with generated software without losing any feature in the requirement;",
"Now, you should check the above regulations one by one and review the codes in detail, propose one comment with the highest priority about the codes, and give me instructions on how to fix. Tell me your comment with the highest priority and corresponding suggestions on revision. If the codes are perfect and you have no comment on them, return only one line like \"<INFO> Finished\"."
]
},
"CodeReviewModification": {
"assistant_role_name": "Programmer",
"user_role_name": "Code Reviewer",
"phase_prompt": [
"According to the new user's task, our designed product modality, languages and ideas, our developed first-edition source codes are listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"Comments on Codes:",
"\"{comments}\"",
"In the software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code. Format:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and make the software creative, executive and robust, you should modify corresponding codes according to the comments. Then, output the full and complete codes with all bugs fixed based on the comments. Return all codes strictly following the required format."
]
},
"TestErrorSummary": {
"assistant_role_name": "Programmer",
"user_role_name": "Software Test Engineer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Test Reports of Source Codes:",
"\"{test_reports}\"",
"According to my test reports, please locate and summarize the bugs that cause the problem."
]
},
"TestModification": {
"assistant_role_name": "Programmer",
"user_role_name": "Software Test Engineer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Test Reports of Source Codes:",
"\"{test_reports}\"",
"Error Summary of Test Reports:",
"\"{error_summary}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and make the software execute smoothly and robustly, you should modify the codes based on the error summary. Now, use the format exemplified above and modify the problematic codes based on the error summary. Output the codes that you fixed based on the test reported and corresponding explanations (strictly follow the format defined above, including FILENAME, LANGUAGE, DOCSTRING and CODE; incomplete \"TODO\" codes are strictly prohibited). If no bugs are reported, please return only one line like \"<INFO> Finished\"."
]
},
"EnvironmentDoc": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"The new user's task and our developed codes are listed: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"As the {assistant_role}, you should write a requirements.txt file, which is commonly used in Python projects to specify the dependencies or packages required for the project to run properly. It serves as a way to document and manage the project's dependencies in a standardized format. For example:",
"requirements.txt",
"```",
"numpy==1.19.2",
"pandas>=1.1.4",
"```",
"According to the codes and file format listed above, write a requirements.txt file to specify the dependencies or packages required for the project to run properly."
]
},
"Manual": {
"assistant_role_name": "Chief Product Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"The new user's task, our developed codes and required dependencies are listed: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"Requirements:",
"\"{requirements}\"",
"As the {assistant_role}, by using Markdown, you should write a manual.md file which is a detailed user manual to use the software, including introducing main functions of the software, how to install environment dependencies and how to use/play it. For example:",
"manual.md",
"```",
"# LangChain",
"Building applications with LLMs through composability",
"Looking for the JS/TS version? Check out LangChain.js.",
"**Production Support:** As you move your LangChains into production, we'd love to offer more comprehensive support.",
"Please fill out this form and we'll set up a dedicated support Slack channel.",
"## Quick Install",
"`pip install langchain`",
"or",
"`conda install langchain -c conda-forge`",
"## 🤔 What is this?",
"Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. However, using these LLMs in isolation is often insufficient for creating a truly powerful app - the real power comes when you can combine them with other sources of computation or knowledge.",
"This library aims to assist in the development of those types of applications. Common examples of these applications include:",
"**❓ Question Answering over specific documents**",
"- Documentation",
"- End-to-end Example: Question Answering over Notion Database",
"**🤖 Agents**",
"- Documentation",
"- End-to-end Example: GPT+WolframAlpha",
"## 📖 Documentation",
"Please see [here](https://python.langchain.com) for full documentation on:",
"- Getting started (installation, setting up the environment, simple examples)",
"- How-To examples (demos, integrations, helper functions)",
"- Reference (full API docs)",
"- Resources (high-level explanation of core concepts)",
"```"
]
}
}

View File

@ -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."
]
}

View File

@ -0,0 +1,27 @@
'''
This file contains the Game class which manages the game logic.
'''
class Game:
def __init__(self):
self.board = [[0] * 15 for _ in range(15)]
self.current_player = 1
def make_move(self, x, y):
if self.board[y][x] == 0:
self.board[y][x] = self.current_player
self.current_player = 3 - self.current_player
return True
return False
def check_win(self, x, y):
directions = [(1, 0), (0, 1), (1, 1), (1, -1), (-1, 0), (0, -1), (-1, -1), (-1, 1)]
for dx, dy in directions:
count = 1
for i in range(-4, 5):
nx = x + dx * i
ny = y + dy * i
if 0 <= nx < 15 and 0 <= ny < 15 and self.board[ny][nx] == self.current_player:
count += 1
else:
break
if count >= 5:
return True
return False

View File

@ -0,0 +1,38 @@
'''
This is the main file of the Gomoku game.
'''
import tkinter as tk
from tkinter import messagebox
from game import Game
class GomokuApp:
def __init__(self, master):
self.master = master
self.master.title("Gomoku")
self.game = Game()
self.canvas = tk.Canvas(self.master, width=600, height=600, bg="white")
self.canvas.pack()
self.canvas.bind("<Button-1>", self.on_click)
self.draw_board()
def draw_board(self):
self.canvas.delete("all")
for i in range(15):
self.canvas.create_line(40 + i * 40, 40, 40 + i * 40, 600 - 40)
self.canvas.create_line(40, 40 + i * 40, 600 - 40, 40 + i * 40)
def on_click(self, event):
x = (event.x - 40) // 40
y = (event.y - 40) // 40
if self.game.make_move(x, y):
self.draw_piece(x, y)
if self.game.check_win(x, y):
self.show_winner()
def draw_piece(self, x, y):
color = "black" if self.game.current_player == 1 else "white"
self.canvas.create_oval(40 + x * 40 - 18, 40 + y * 40 - 18, 40 + x * 40 + 18, 40 + y * 40 + 18, fill=color)
def show_winner(self):
winner = "Black" if self.game.current_player == 1 else "White"
messagebox.showinfo("Game Over", f"{winner} wins!")
self.master.quit()
if __name__ == "__main__":
root = tk.Tk()
app = GomokuApp(root)
root.mainloop()

View File

@ -0,0 +1,47 @@
# Gomoku Game User Manual
## Introduction
Welcome to the Gomoku Game User Manual! This manual will guide you on how to install and play the Gomoku game developed by ChatDev. Gomoku is a classic board game where players take turns placing their pieces on a grid to form a line of five pieces in a row, either horizontally, vertically, or diagonally.
## Installation
To install and run the Gomoku game, please follow the steps below:
1. Ensure that you have Python installed on your system. If not, you can download and install Python from the official website: [https://www.python.org/downloads/](https://www.python.org/downloads/)
2. Download the Gomoku game files from the provided source.
3. Open a terminal or command prompt and navigate to the directory where you downloaded the Gomoku game files.
4. Install the required dependencies by running the following command:
```
pip install -r requirements.txt
```
This will install the necessary dependencies, including the `tkinter` library.
## Playing the Game
Once you have installed the game, you can start playing by following these steps:
1. Open a terminal or command prompt and navigate to the directory where you downloaded the Gomoku game files.
2. Run the game by executing the following command:
```
python main.py
```
3. A new window will open with the Gomoku game board.
4. Players take turns clicking on the empty cells of the board to place their pieces. The first player to form a line of five pieces in a row wins the game.
5. If a player wins, a message box will appear indicating the winner. Click "OK" to close the message box and exit the game.
6. To start a new game, simply close the game window and run the `main.py` file again.
## Conclusion
Congratulations! You have successfully installed and played the Gomoku game developed by ChatDev. Enjoy playing and have fun! If you have any questions or encounter any issues, please feel free to reach out to our support team for assistance.

View File

@ -0,0 +1,33 @@
Task:
Develop a basic Gomoku game.
Config:
ChatEnvConfig.with_memory: False
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

View File

@ -0,0 +1 @@
tkinter==8.6

File diff suppressed because one or more lines are too long

View File

@ -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'."
}

View File

@ -0,0 +1 @@
Develop a basic Gomoku game.

View File

@ -0,0 +1,278 @@
{
"DemandAnalysis": {
"assistant_role_name": "Chief Product Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"ChatDev has made products in the following form before:",
"Image: can present information in line chart, bar chart, flow chart, cloud chart, Gantt chart, etc.",
"Document: can present information via .docx files.",
"PowerPoint: can present information via .pptx files.",
"Excel: can present information via .xlsx files.",
"PDF: can present information via .pdf files.",
"Website: can present personal resume, tutorial, products, or ideas, via .html files.",
"Application: can implement visualized game, software, tool, etc, via python.",
"Dashboard: can display a panel visualizing real-time information.",
"Mind Map: can represent ideas, with related concepts arranged around a core concept.",
"As the {assistant_role}, to satisfy the new user's demand and the product should be realizable, you should keep discussing with me to decide which product modality do we want the product to be?",
"Note that we must ONLY discuss the product modality and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion by replying with only one line, which starts with a single word <INFO>, followed by our final product modality without any other words, e.g., \"<INFO> PowerPoint\"."
]
},
"LanguageChoose": {
"assistant_role_name": "Chief Technology Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"According to the new user's task and some creative brainstorm ideas listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Ideas: \"{ideas}\".",
"We have decided to complete the task through a executable software implemented via a programming language. ",
"As the {assistant_role}, to satisfy the new user's demand and make the software realizable, you should propose a concrete programming language. If python can complete this task via Python, please answer Python; otherwise, answer another programming language (e.g., Java, C++, etc,).",
"Note that we must ONLY discuss the target programming language and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion and conclude the best programming language we have discussed without any other words or reasons, return only one line using the format: \"<INFO> *\" where \"*\" represents a programming language."
]
},
"Coding": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"According to the new user's task and our software designs listed below: ",
"Task: \"{task}\".",
"Task description: \"{description}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas:\"{ideas}\"",
"We have decided to complete the task through a executable software with multiple files implemented via {language}. As the {assistant_role}, to satisfy the new user's demands, you should write one or multiple files and make sure that every detail of the architecture is, in the end, implemented as code. {gui}",
"Think step by step and reason yourself to the right decisions to make sure we get it right.",
"You will first lay out the names of the core classes, functions, methods that will be necessary, as well as a quick comment on their purpose.",
"Then you will output the content of each file including complete code. Each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"You will start with the \"main\" file, then go to the ones that are imported by that file, and so on.",
"Please note that the code should be fully functional. Ensure to implement all functions. No placeholders (such as 'pass' in Python)."
]
},
"ArtDesign": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Creative Officer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Task: \"{task}\".",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and equip the software with a beautiful graphical user interface (GUI), we will discuss and design many decorative images for GUI decoration. Now, we keep discussing the GUI beautification by listing some functionally independent elements in GUI that are being considered to be decorated by different pictures. For example, ten digits (0-9) in a calculator are functionally independent.",
"To answer, use the format: \" FILENAME.png: DESCRIPTION\" where \"FILENAME\" is the filename of the image and \"DESCRIPTION\" denotes the detailed description of the independent elements. For example:",
"'''",
"button_1.png: The button with the number \"1\" on it.",
"button_multiply.png: The button with the multiplication symbol (\"*\") on it.",
"background.png: the background color to decorate the Go game",
"'''",
"Now, list all functionally independent elements as much as possible."
]
},
"ArtIntegration": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Creative Officer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Task: \"{task}\".",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and equip the software with a beautiful graphical user interface (GUI), you will incorporate our designed images for GUI decoration. Here are some ready-made high-quality pictures and corresponding descriptions:",
"{images}",
"Note that the designed images have a fixed size of 256x256 pixels and the images are located in the same directory as all the Python files; please dynamically scaling these images according to the size of GUI, and use \"self.*\" to avoid displaying-related problems caused by automatic garbage collection. For example:",
"```",
"self.image = ImageTk.PhotoImage(Image.open(\"./image.png\").resize((50, 50)))",
"```",
"Now, use some or all of the pictures into the GUI to make it more beautiful and creative. Output codes strictly following the required format mentioned above."
]
},
"CodeComplete": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"According to the new user's task and our software designs listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Codes:",
"\"{codes}\"",
"Unimplemented File:",
"\"{unimplemented_file}\"",
"In our software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the complete function of our developed software, you have to implement all methods in the {unimplemented_file} file which contains a unimplemented class. Now, implement all methods of the {unimplemented_file} and all other codes needed, then output the fully implemented codes, strictly following the required format."
]
},
"CodeReviewComment": {
"assistant_role_name": "Code Reviewer",
"user_role_name": "Programmer",
"phase_prompt": [
"According to the new user's task and our software designs: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes:",
"\"{codes}\"",
"As the {assistant_role}, to make the software directly operable without further coding, ChatDev have formulated the following regulations:",
"1) all referenced classes should be imported;",
"2) all methods should be implemented;",
"3) all methods need to have the necessary comments;",
"4) no potential bugs;",
"5) The entire project conforms to the tasks proposed by the user;",
"6) most importantly, do not only check the errors in the code, but also the logic of code. Make sure that user can interact with generated software without losing any feature in the requirement;",
"Now, you should check the above regulations one by one and review the codes in detail, propose one comment with the highest priority about the codes, and give me instructions on how to fix. Tell me your comment with the highest priority and corresponding suggestions on revision. If the codes are perfect and you have no comment on them, return only one line like \"<INFO> Finished\"."
]
},
"CodeReviewModification": {
"assistant_role_name": "Programmer",
"user_role_name": "Code Reviewer",
"phase_prompt": [
"According to the new user's task, our designed product modality, languages and ideas, our developed first-edition source codes are listed below: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"Comments on Codes:",
"\"{comments}\"",
"In the software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code. Format:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and make the software creative, executive and robust, you should modify corresponding codes according to the comments. Then, output the full and complete codes with all bugs fixed based on the comments. Return all codes strictly following the required format."
]
},
"TestErrorSummary": {
"assistant_role_name": "Programmer",
"user_role_name": "Software Test Engineer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Test Reports of Source Codes:",
"\"{test_reports}\"",
"According to my test reports, please locate and summarize the bugs that cause the problem."
]
},
"TestModification": {
"assistant_role_name": "Programmer",
"user_role_name": "Software Test Engineer",
"phase_prompt": [
"Our developed source codes and corresponding test reports are listed below: ",
"Programming Language: \"{language}\"",
"Source Codes:",
"\"{codes}\"",
"Test Reports of Source Codes:",
"\"{test_reports}\"",
"Error Summary of Test Reports:",
"\"{error_summary}\"",
"Note that each file must strictly follow a markdown code block format, where the following tokens must be replaced such that \"FILENAME\" is the lowercase file name including the file extension, \"LANGUAGE\" in the programming language, \"DOCSTRING\" is a string literal specified in source code that is used to document a specific segment of code, and \"CODE\" is the original code:",
"FILENAME",
"```LANGUAGE",
"'''",
"DOCSTRING",
"'''",
"CODE",
"```",
"As the {assistant_role}, to satisfy the new user's demand and make the software execute smoothly and robustly, you should modify the codes based on the error summary. Now, use the format exemplified above and modify the problematic codes based on the error summary. Output the codes that you fixed based on the test reported and corresponding explanations (strictly follow the format defined above, including FILENAME, LANGUAGE, DOCSTRING and CODE; incomplete \"TODO\" codes are strictly prohibited). If no bugs are reported, please return only one line like \"<INFO> Finished\"."
]
},
"EnvironmentDoc": {
"assistant_role_name": "Programmer",
"user_role_name": "Chief Technology Officer",
"phase_prompt": [
"The new user's task and our developed codes are listed: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"As the {assistant_role}, you should write a requirements.txt file, which is commonly used in Python projects to specify the dependencies or packages required for the project to run properly. It serves as a way to document and manage the project's dependencies in a standardized format. For example:",
"requirements.txt",
"```",
"numpy==1.19.2",
"pandas>=1.1.4",
"```",
"According to the codes and file format listed above, write a requirements.txt file to specify the dependencies or packages required for the project to run properly."
]
},
"Manual": {
"assistant_role_name": "Chief Product Officer",
"user_role_name": "Chief Executive Officer",
"phase_prompt": [
"The new user's task, our developed codes and required dependencies are listed: ",
"Task: \"{task}\".",
"Modality: \"{modality}\".",
"Programming Language: \"{language}\"",
"Ideas: \"{ideas}\"",
"Codes: ",
"\"{codes}\"",
"Requirements:",
"\"{requirements}\"",
"As the {assistant_role}, by using Markdown, you should write a manual.md file which is a detailed user manual to use the software, including introducing main functions of the software, how to install environment dependencies and how to use/play it. For example:",
"manual.md",
"```",
"# LangChain",
"Building applications with LLMs through composability",
"Looking for the JS/TS version? Check out LangChain.js.",
"**Production Support:** As you move your LangChains into production, we'd love to offer more comprehensive support.",
"Please fill out this form and we'll set up a dedicated support Slack channel.",
"## Quick Install",
"`pip install langchain`",
"or",
"`conda install langchain -c conda-forge`",
"## 🤔 What is this?",
"Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. However, using these LLMs in isolation is often insufficient for creating a truly powerful app - the real power comes when you can combine them with other sources of computation or knowledge.",
"This library aims to assist in the development of those types of applications. Common examples of these applications include:",
"**❓ Question Answering over specific documents**",
"- Documentation",
"- End-to-end Example: Question Answering over Notion Database",
"**🤖 Agents**",
"- Documentation",
"- End-to-end Example: GPT+WolframAlpha",
"## 📖 Documentation",
"Please see [here](https://python.langchain.com) for full documentation on:",
"- Getting started (installation, setting up the environment, simple examples)",
"- How-To examples (demos, integrations, helper functions)",
"- Reference (full API docs)",
"- Resources (high-level explanation of core concepts)",
"```"
]
}
}

View File

@ -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."
]
}

View File

@ -0,0 +1,39 @@
'''
This file contains the Game class which manages the game logic.
'''
class Game:
def __init__(self):
# Initialize the game board
self.board = [[0] * 15 for _ in range(15)]
self.current_player = 1
def make_move(self, row, col):
# Check if the move is valid
if self.board[row][col] == 0:
# Make the move
self.board[row][col] = self.current_player
# Switch to the next player
self.current_player = 3 - self.current_player
return True
else:
return False
def check_winner(self):
# Check rows
for row in range(15):
for col in range(11):
if self.board[row][col] != 0 and self.board[row][col] == self.board[row][col+1] == self.board[row][col+2] == self.board[row][col+3] == self.board[row][col+4]:
return self.board[row][col]
# Check columns
for row in range(11):
for col in range(15):
if self.board[row][col] != 0 and self.board[row][col] == self.board[row+1][col] == self.board[row+2][col] == self.board[row+3][col] == self.board[row+4][col]:
return self.board[row][col]
# Check diagonals
for row in range(11):
for col in range(11):
if self.board[row][col] != 0 and self.board[row][col] == self.board[row+1][col+1] == self.board[row+2][col+2] == self.board[row+3][col+3] == self.board[row+4][col+4]:
return self.board[row][col]
for row in range(11):
for col in range(4, 15):
if self.board[row][col] != 0 and self.board[row][col] == self.board[row+1][col-1] == self.board[row+2][col-2] == self.board[row+3][col-3] == self.board[row+4][col-4]:
return self.board[row][col]
return 0

View File

@ -0,0 +1,36 @@
'''
This file contains the GUI class which handles the graphical user interface.
'''
import tkinter as tk
from tkinter import messagebox
class GUI:
def __init__(self, game):
self.game = game
# Create the main window
self.root = tk.Tk()
self.root.title("Gomoku")
self.root.geometry("500x500")
# Create the game board
self.board_frame = tk.Frame(self.root)
self.board_frame.pack()
self.buttons = []
for row in range(15):
row_buttons = []
for col in range(15):
button = tk.Button(self.board_frame, width=2, height=1, command=lambda r=row, c=col: self.make_move(r, c))
button.grid(row=row, column=col)
row_buttons.append(button)
self.buttons.append(row_buttons)
def make_move(self, row, col):
# Make the move
if self.game.make_move(row, col):
# Update the button text
self.buttons[row][col].config(text="X" if self.game.current_player == 1 else "O")
# Check for a winner
winner = self.game.check_winner()
if winner != 0:
messagebox.showinfo("Game Over", f"Player {winner} wins!")
self.root.quit()
def run(self):
# Start the main event loop
self.root.mainloop()

View File

@ -0,0 +1,14 @@
'''
This is the main file for the Gomoku game.
'''
from game import Game
from gui import GUI
def main():
# Create an instance of the game
game = Game()
# Create an instance of the GUI
gui = GUI(game)
# Start the game loop
gui.run()
if __name__ == "__main__":
main()

View File

@ -1,37 +0,0 @@
[2024-25-01 11:07:49 INFO] [Config]:{'experience': {'reap_zombie': True, 'threshold': 0, 'upper_limit': 10}, 'codes': {'tmp_directory': 'tmp_codes', 'main_script': 'main.py'}, 'embedding_method': 'OpenAI', 'retrieval': {'top_k_code': 1, 'top_k_text': 1, 'searchcode_thresh': 0, 'searchtext_thresh': 0}}
[2024-25-01 11:07:49 INFO] log_filename:20230822144615.log
[2024-25-01 11:07:49 INFO]
************************************************** Graph **************************************************
1 Nodes:
8ca64b76d3bf365d82f5c88cec867bee, 0.0,
0 Edges:
************************************************** Graph **************************************************
[2024-25-01 11:07:49 INFO] No node or edges constrcuted from the Warehouse, maybe unfinished software production
[2024-25-01 11:07:49 INFO] DONE: got all EDGE embeddings
EDGE embedding time cost:0.0
[2024-25-01 11:07:52 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:07:52 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1351
total_tokens: 1351
[2024-25-01 11:07:52 INFO] DONE: get node embedding
time cost:2.2512760162353516
[2024-25-01 11:07:52 INFO] DONE: got all NODE embeddings
NODE embedding time cost:2.2512760162353516
[2024-25-01 11:07:52 INFO] DONE: got all EXPERIENCE embeddings
EXPERIENCE embedding time cost:0.0
[2024-25-01 11:07:52 INFO] All embedding DONE
time cost:2.2512760162353516
[2024-25-01 11:07:52 INFO] len(previous_memory)=11
[2024-25-01 11:07:52 INFO] len(merged_dic)=12
merged_dic dumped to C:\Users\Dang_Yufan\ChatDev\ecl\memory\MemoryCards.json
[2024-25-01 11:07:52 INFO] [Conclusion]:
text_prompt_tokens:0, text_total_tokens:0
code_prompt_tokens:1351, code_total_tokens:1351
prompt_tokens:1351, total_tokens:1351

View File

@ -1,135 +0,0 @@
[2024-25-01 11:07:52 INFO] [Config]:{'experience': {'reap_zombie': True, 'threshold': 0, 'upper_limit': 10}, 'codes': {'tmp_directory': 'tmp_codes', 'main_script': 'main.py'}, 'embedding_method': 'OpenAI', 'retrieval': {'top_k_code': 1, 'top_k_text': 1, 'searchcode_thresh': 0, 'searchtext_thresh': 0}}
[2024-25-01 11:07:52 INFO] log_filename:ArtCanvas_THUNLP_20230825093558.log
[2024-25-01 11:07:52 INFO]
************************************************** Graph **************************************************
4 Nodes:
94e7ccc362cb671a4da4026aeb82846d, 0.0,
d15577173c6a908f5c787c69b26234d2, 1.0,
296caeb939361dcdb44bb49099eb8a50, 2.0,
7a2b3666e21805f40a953525e3e301f8, 3.0,
6 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 94e7ccc362cb671a4da4026aeb82846d -> d15577173c6a908f5c787c69b26234d2 (chief technology officer: write one or multiple files and make sure that every detail )
188e36dc418d7528d235201495b6fec8: d15577173c6a908f5c787c69b26234d2 -> 296caeb939361dcdb44bb49099eb8a50 (code reviewer: the code is missing the import statement for the `canvas` cl)
98e78da69ac1249f4fe659dae5829580: 296caeb939361dcdb44bb49099eb8a50 -> d15577173c6a908f5c787c69b26234d2 (code reviewer: the code is missing the implementation of the toolbar class.)
5508d1c5ac8e1c0359bbdd6ba7c87d89: d15577173c6a908f5c787c69b26234d2 -> d15577173c6a908f5c787c69b26234d2 (code reviewer: the code is missing the import statement for the toolbar cla)
754ca90350d942f934775411666deec7: d15577173c6a908f5c787c69b26234d2 -> 7a2b3666e21805f40a953525e3e301f8 (chief technology officer: write one or multiple files and make sure that every detail )
0391f5714d99cc404713479f1f5f4994: 7a2b3666e21805f40a953525e3e301f8 -> 7a2b3666e21805f40a953525e3e301f8 (software test engineer: Test Pass!)
************************************************** Graph **************************************************
[2024-25-01 11:07:52 INFO] ZOMBIE EDGES:
Zombie Edge d15577173c6a908f5c787c69b26234d2 -> 296caeb939361dcdb44bb49099eb8a50 Removed
Zombie Edge 296caeb939361dcdb44bb49099eb8a50 -> d15577173c6a908f5c787c69b26234d2 Removed
Zombie Edge d15577173c6a908f5c787c69b26234d2 -> d15577173c6a908f5c787c69b26234d2 Removed
Zombie Edge 7a2b3666e21805f40a953525e3e301f8 -> 7a2b3666e21805f40a953525e3e301f8 Removed
[2024-25-01 11:07:52 INFO] ZOMBIE NODES:
Zombie Node 296caeb939361dcdb44bb49099eb8a50 Removed
[2024-25-01 11:07:52 INFO]
************************************************** Graph **************************************************
3 Nodes:
94e7ccc362cb671a4da4026aeb82846d, 0.0,
d15577173c6a908f5c787c69b26234d2, 1.0,
7a2b3666e21805f40a953525e3e301f8, 3.0,
2 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 94e7ccc362cb671a4da4026aeb82846d -> d15577173c6a908f5c787c69b26234d2 (chief technology officer: write one or multiple files and make sure that every detail )
754ca90350d942f934775411666deec7: d15577173c6a908f5c787c69b26234d2 -> 7a2b3666e21805f40a953525e3e301f8 (chief technology officer: write one or multiple files and make sure that every detail )
************************************************** Graph **************************************************
[2024-25-01 11:08:20 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:20 INFO] Get code embedding from /var/azureml-app/azureml-models/text-embedding-ada-002-8k/584175/:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 362
total_tokens: 362
[2024-25-01 11:08:20 INFO] DONE:get node embedding
time cost:21.40918803215027
[2024-25-01 11:08:22 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:22 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 363
total_tokens: 363
[2024-25-01 11:08:22 INFO] DONE:get node embedding
time cost:2.448246955871582
[2024-25-01 11:08:24 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:24 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 24
total_tokens: 24
[2024-25-01 11:08:24 INFO] DONE:get task prompt embedding
time cost:2.1231791973114014
[2024-25-01 11:08:27 INFO] Init value:{'94e7ccc362cb671a4da4026aeb82846d': 0.0, 'd15577173c6a908f5c787c69b26234d2': 0.4134325174441662, '7a2b3666e21805f40a953525e3e301f8': 1}
Estimated value:{'94e7ccc362cb671a4da4026aeb82846d': 0.0, 'd15577173c6a908f5c787c69b26234d2': 0.4134325174441662, '7a2b3666e21805f40a953525e3e301f8': 1}
[2024-25-01 11:08:38 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:08:38 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 967
completion_tokens: 692
total_tokens: 1659
[2024-25-01 11:08:38 INFO] Sorted-and-Truncated Experiences (with instructionStar):94e7ccc362cb671a4da4026aeb82846d -> 7a2b3666e21805f40a953525e3e301f8 valueGain=1.000000 len(instructionPath)=2 instructionStar=To transition from the initial code version to the final version, follow these steps:1. Import the
[2024-25-01 11:08:38 INFO] [Conclusion]:
prompt_tokens:967, completion_tokens:692, total_tokens:1659
[2024-25-01 11:08:38 INFO] [Conclusion]:
text_prompt_tokens:24, text_total_tokens:24
code_prompt_tokens:725, code_total_tokens:725
prompt_tokens:749, total_tokens:749
[2024-25-01 11:08:41 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:41 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 18
total_tokens: 18
[2024-25-01 11:08:41 INFO] DONE: get edge embedding
time cost:2.973163366317749
[2024-25-01 11:08:43 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:43 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 18
total_tokens: 18
[2024-25-01 11:08:43 INFO] DONE: get edge embedding
time cost:2.3684914112091064
[2024-25-01 11:08:43 INFO] DONE: got all EDGE embeddings
EDGE embedding time cost:5.343662977218628
[2024-25-01 11:08:46 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:46 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 357
total_tokens: 357
[2024-25-01 11:08:46 INFO] DONE: get node embedding
time cost:2.349684000015259
[2024-25-01 11:08:46 INFO] DONE: got all NODE embeddings
NODE embedding time cost:2.351797580718994
[2024-25-01 11:08:48 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:48 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 692
total_tokens: 692
[2024-25-01 11:08:48 INFO] DONE: get exprience embedding
time cost:2.284816265106201
[2024-25-01 11:08:48 INFO] DONE: got all EXPERIENCE embeddings
EXPERIENCE embedding time cost:2.2858166694641113
[2024-25-01 11:08:48 INFO] All embedding DONE
time cost:9.981277227401733
[2024-25-01 11:08:48 INFO] len(previous_memory)=12
[2024-25-01 11:08:48 INFO] len(merged_dic)=13
merged_dic dumped to C:\Users\Dang_Yufan\ChatDev\ecl\memory\MemoryCards.json
[2024-25-01 11:08:48 INFO] [Conclusion]:
text_prompt_tokens:728, text_total_tokens:728
code_prompt_tokens:357, code_total_tokens:357
prompt_tokens:1085, total_tokens:1085

View File

@ -1,72 +0,0 @@
[2024-25-01 11:08:48 INFO] [Config]:{'experience': {'reap_zombie': True, 'threshold': 0, 'upper_limit': 10}, 'codes': {'tmp_directory': 'tmp_codes', 'main_script': 'main.py'}, 'embedding_method': 'OpenAI', 'retrieval': {'top_k_code': 1, 'top_k_text': 1, 'searchcode_thresh': 0, 'searchtext_thresh': 0}}
[2024-25-01 11:08:49 INFO] log_filename:Article_pic_DefaultOrganization_20231023003059.log
[2024-25-01 11:08:49 INFO]
************************************************** Graph **************************************************
10 Nodes:
499a94178e77ec59287b9931f3faba14, 0.0,
75e4b99bc718dc686b9078ded9f46344, 1.0,
ab2e114a624cd95bd0356a4aa4211586, 2.0,
e914d178698bc886cc50eda3ad8b0d00, 3.0,
7b663e922cdf851b8f0558d1b2aa27eb, 4.0,
78a104c9c54e8716ab328b1993291301, 5.0,
9a5d48ec271eeee36cf6e34766b6b2ad, 6.0,
ecbfd1a2f4ea6ef05b686c9d68fa0c2c, 7.0,
11318a174b423049c69932d607c30b37, 8.0,
2efcf0236acf8f34d516672d53db7356, 9.0,
11 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 499a94178e77ec59287b9931f3faba14 -> 75e4b99bc718dc686b9078ded9f46344 (chief technology officer: write one or multiple files and make sure that every detail )
188e36dc418d7528d235201495b6fec8: 75e4b99bc718dc686b9078ded9f46344 -> ab2e114a624cd95bd0356a4aa4211586 (code reviewer: the code provided seems to be well-structured and follows go)
98e78da69ac1249f4fe659dae5829580: ab2e114a624cd95bd0356a4aa4211586 -> e914d178698bc886cc50eda3ad8b0d00 (code reviewer: the code provided is well-structured and follows good practi)
5508d1c5ac8e1c0359bbdd6ba7c87d89: e914d178698bc886cc50eda3ad8b0d00 -> e914d178698bc886cc50eda3ad8b0d00 (code reviewer: the code provided is well-structured and follows good progra)
754ca90350d942f934775411666deec7: e914d178698bc886cc50eda3ad8b0d00 -> e914d178698bc886cc50eda3ad8b0d00 (code reviewer: where do you save the final article?
where do you save the i)
0391f5714d99cc404713479f1f5f4994: e914d178698bc886cc50eda3ad8b0d00 -> 7b663e922cdf851b8f0558d1b2aa27eb (code reviewer: when i click "find image" you should start to search the sui)
a2d0d0a414869e1f8ba0a87989d7af34: 7b663e922cdf851b8f0558d1b2aa27eb -> 78a104c9c54e8716ab328b1993291301 (code reviewer: when i click a button, you should give me an alert to tell m)
bf81800eb96d4bae975d11f539882328: 78a104c9c54e8716ab328b1993291301 -> 9a5d48ec271eeee36cf6e34766b6b2ad (code reviewer: the website you choose to generate picture is too compilicat)
c0be33704654e701027729ce44f42f21: 9a5d48ec271eeee36cf6e34766b6b2ad -> ecbfd1a2f4ea6ef05b686c9d68fa0c2c (code reviewer: i cannot feel that you have done anything following my order)
c493d09e36783173a786220d05861185: ecbfd1a2f4ea6ef05b686c9d68fa0c2c -> 11318a174b423049c69932d607c30b37 (software test engineer: software test engineer: **[start chat]**
[chatdev is a soft)
aa8d81d5d1f843bb1a98181cf14d996c: 11318a174b423049c69932d607c30b37 -> 2efcf0236acf8f34d516672d53db7356 (software test engineer: based on the test reports, the bug causing the problem is an)
************************************************** Graph **************************************************
[2024-25-01 11:08:49 INFO] ZOMBIE EDGES:
Zombie Edge e914d178698bc886cc50eda3ad8b0d00 -> e914d178698bc886cc50eda3ad8b0d00 Removed
Zombie Edge e914d178698bc886cc50eda3ad8b0d00 -> e914d178698bc886cc50eda3ad8b0d00 Removed
[2024-25-01 11:08:49 INFO] ZOMBIE NODES:
[2024-25-01 11:08:49 INFO]
************************************************** Graph **************************************************
10 Nodes:
499a94178e77ec59287b9931f3faba14, 0.0,
75e4b99bc718dc686b9078ded9f46344, 1.0,
ab2e114a624cd95bd0356a4aa4211586, 2.0,
e914d178698bc886cc50eda3ad8b0d00, 3.0,
7b663e922cdf851b8f0558d1b2aa27eb, 4.0,
78a104c9c54e8716ab328b1993291301, 5.0,
9a5d48ec271eeee36cf6e34766b6b2ad, 6.0,
ecbfd1a2f4ea6ef05b686c9d68fa0c2c, 7.0,
11318a174b423049c69932d607c30b37, 8.0,
2efcf0236acf8f34d516672d53db7356, 9.0,
9 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 499a94178e77ec59287b9931f3faba14 -> 75e4b99bc718dc686b9078ded9f46344 (chief technology officer: write one or multiple files and make sure that every detail )
188e36dc418d7528d235201495b6fec8: 75e4b99bc718dc686b9078ded9f46344 -> ab2e114a624cd95bd0356a4aa4211586 (code reviewer: the code provided seems to be well-structured and follows go)
98e78da69ac1249f4fe659dae5829580: ab2e114a624cd95bd0356a4aa4211586 -> e914d178698bc886cc50eda3ad8b0d00 (code reviewer: the code provided is well-structured and follows good practi)
0391f5714d99cc404713479f1f5f4994: e914d178698bc886cc50eda3ad8b0d00 -> 7b663e922cdf851b8f0558d1b2aa27eb (code reviewer: when i click "find image" you should start to search the sui)
a2d0d0a414869e1f8ba0a87989d7af34: 7b663e922cdf851b8f0558d1b2aa27eb -> 78a104c9c54e8716ab328b1993291301 (code reviewer: when i click a button, you should give me an alert to tell m)
bf81800eb96d4bae975d11f539882328: 78a104c9c54e8716ab328b1993291301 -> 9a5d48ec271eeee36cf6e34766b6b2ad (code reviewer: the website you choose to generate picture is too compilicat)
c0be33704654e701027729ce44f42f21: 9a5d48ec271eeee36cf6e34766b6b2ad -> ecbfd1a2f4ea6ef05b686c9d68fa0c2c (code reviewer: i cannot feel that you have done anything following my order)
c493d09e36783173a786220d05861185: ecbfd1a2f4ea6ef05b686c9d68fa0c2c -> 11318a174b423049c69932d607c30b37 (software test engineer: software test engineer: **[start chat]**
[chatdev is a soft)
aa8d81d5d1f843bb1a98181cf14d996c: 11318a174b423049c69932d607c30b37 -> 2efcf0236acf8f34d516672d53db7356 (software test engineer: based on the test reports, the bug causing the problem is an)
************************************************** Graph **************************************************
[2024-25-01 11:08:58 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:08:58 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 447
total_tokens: 447
[2024-25-01 11:08:58 INFO] DONE:get node embedding
time cost:3.5063462257385254

View File

@ -1,147 +0,0 @@
[2024-25-01 11:02:26 INFO] [Config]:{'experience': {'reap_zombie': True, 'threshold': 0, 'upper_limit': 10}, 'codes': {'tmp_directory': 'tmp_codes', 'main_script': 'main.py'}, 'embedding_method': 'OpenAI', 'retrieval': {'top_k_code': 1, 'top_k_text': 1, 'searchcode_thresh': 0, 'searchtext_thresh': 0}}
[2024-25-01 11:02:26 INFO] log_filename:Gomoku_DefaultOrganization_20240125104410.log
[2024-25-01 11:02:26 INFO]
************************************************** Graph **************************************************
4 Nodes:
826916147bfe023d407e3096fbbc3431, 0.0,
76905434c4b0a909c179f033485bd34f, 1.0,
fc5ec6c6e58a139cb9c41f1a43e7eff9, 2.0,
2eba79a65574c4f2f51f4e219aae1311, 3.0,
3 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 826916147bfe023d407e3096fbbc3431 -> 76905434c4b0a909c179f033485bd34f (chief technology officer: write one or multiple files and make sure that every detail )
188e36dc418d7528d235201495b6fec8: 76905434c4b0a909c179f033485bd34f -> fc5ec6c6e58a139cb9c41f1a43e7eff9 (code reviewer: the code provided seems to be well-structured and follows mo)
98e78da69ac1249f4fe659dae5829580: fc5ec6c6e58a139cb9c41f1a43e7eff9 -> 2eba79a65574c4f2f51f4e219aae1311 (code reviewer: the code is missing the import statement for the `tkinter` m)
************************************************** Graph **************************************************
[2024-25-01 11:02:26 INFO] ZOMBIE EDGES:
[2024-25-01 11:02:26 INFO] ZOMBIE NODES:
[2024-25-01 11:02:26 INFO]
************************************************** Graph **************************************************
4 Nodes:
826916147bfe023d407e3096fbbc3431, 0.0,
76905434c4b0a909c179f033485bd34f, 1.0,
fc5ec6c6e58a139cb9c41f1a43e7eff9, 2.0,
2eba79a65574c4f2f51f4e219aae1311, 3.0,
3 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 826916147bfe023d407e3096fbbc3431 -> 76905434c4b0a909c179f033485bd34f (chief technology officer: write one or multiple files and make sure that every detail )
188e36dc418d7528d235201495b6fec8: 76905434c4b0a909c179f033485bd34f -> fc5ec6c6e58a139cb9c41f1a43e7eff9 (code reviewer: the code provided seems to be well-structured and follows mo)
98e78da69ac1249f4fe659dae5829580: fc5ec6c6e58a139cb9c41f1a43e7eff9 -> 2eba79a65574c4f2f51f4e219aae1311 (code reviewer: the code is missing the import statement for the `tkinter` m)
************************************************** Graph **************************************************
[2024-25-01 11:02:36 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:02:36 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 943
total_tokens: 943
[2024-25-01 11:02:36 INFO] DONE:get node embedding
time cost:3.336646556854248
[2024-25-01 11:02:38 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:02:38 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 503
total_tokens: 503
[2024-25-01 11:02:38 INFO] DONE:get node embedding
time cost:2.2172911167144775
[2024-25-01 11:02:41 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:02:41 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 8
total_tokens: 8
[2024-25-01 11:02:41 INFO] DONE:get task prompt embedding
time cost:2.999328851699829
[2024-25-01 11:02:47 INFO] Init value:{'826916147bfe023d407e3096fbbc3431': 0.0, '76905434c4b0a909c179f033485bd34f': 0.4149536924750907, 'fc5ec6c6e58a139cb9c41f1a43e7eff9': 0.0, '2eba79a65574c4f2f51f4e219aae1311': 1}
Estimated value:{'826916147bfe023d407e3096fbbc3431': 0.0, '76905434c4b0a909c179f033485bd34f': 0.4149536924750907, 'fc5ec6c6e58a139cb9c41f1a43e7eff9': 0.0, '2eba79a65574c4f2f51f4e219aae1311': 1}
[2024-25-01 11:02:52 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:02:52 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1558
completion_tokens: 217
total_tokens: 1775
[2024-25-01 11:02:52 INFO] Sorted-and-Truncated Experiences (with instructionStar):826916147bfe023d407e3096fbbc3431 -> fc5ec6c6e58a139cb9c41f1a43e7eff9 valueGain=0.000000 len(instructionPath)=2 instructionStar=To transition from the initial code version to the final version, follow these steps:1. In the `ma
[2024-25-01 11:02:52 INFO] [Conclusion]:
prompt_tokens:1558, completion_tokens:217, total_tokens:1775
[2024-25-01 11:02:52 INFO] [Conclusion]:
text_prompt_tokens:8, text_total_tokens:8
code_prompt_tokens:1446, code_total_tokens:1446
prompt_tokens:1454, total_tokens:1454
[2024-25-01 11:02:54 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:02:54 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 18
total_tokens: 18
[2024-25-01 11:02:54 INFO] DONE: get edge embedding
time cost:2.6576905250549316
[2024-25-01 11:02:57 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:02:57 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 250
total_tokens: 250
[2024-25-01 11:02:57 INFO] DONE: get edge embedding
time cost:2.2554848194122314
[2024-25-01 11:02:59 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:02:59 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 145
total_tokens: 145
[2024-25-01 11:02:59 INFO] DONE: get edge embedding
time cost:2.3858988285064697
[2024-25-01 11:02:59 INFO] DONE: got all EDGE embeddings
EDGE embedding time cost:7.302086114883423
[2024-25-01 11:03:02 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:03:02 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 902
total_tokens: 902
[2024-25-01 11:03:02 INFO] DONE: get node embedding
time cost:3.1916801929473877
[2024-25-01 11:03:05 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:03:05 INFO] Get code embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 409
total_tokens: 409
[2024-25-01 11:03:05 INFO] DONE: get node embedding
time cost:2.4289724826812744
[2024-25-01 11:03:05 INFO] DONE: got all NODE embeddings
NODE embedding time cost:5.623643159866333
[2024-25-01 11:03:07 INFO] HTTP Request: POST https://yeysai.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-25-01 11:03:07 INFO] Get text embedding from ada:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 217
total_tokens: 217
[2024-25-01 11:03:07 INFO] DONE: get exprience embedding
time cost:2.273371696472168
[2024-25-01 11:03:07 INFO] DONE: got all EXPERIENCE embeddings
EXPERIENCE embedding time cost:2.275395631790161
[2024-25-01 11:03:07 INFO] All embedding DONE
time cost:15.201124906539917
[2024-25-01 11:03:07 INFO] len(previous_memory)=10
[2024-25-01 11:03:07 INFO] len(merged_dic)=11
merged_dic dumped to C:\Users\Dang_Yufan\ChatDev\ecl\memory\MemoryCards.json
[2024-25-01 11:03:07 INFO] [Conclusion]:
text_prompt_tokens:630, text_total_tokens:630
code_prompt_tokens:1311, code_total_tokens:1311
prompt_tokens:1941, total_tokens:1941

View File

@ -1,121 +0,0 @@
[2024-25-01 11:12:07 INFO] [Config]:{'experience': {'reap_zombie': True, 'threshold': 0, 'upper_limit': 10}, 'codes': {'tmp_directory': 'tmp_codes', 'main_script': 'main.py'}, 'embedding_method': 'OpenAI', 'retrieval': {'top_k_code': 1, 'top_k_text': 1, 'searchcode_thresh': 0, 'searchtext_thresh': 0}}
[2024-25-01 11:12:07 INFO] log_filename:gomokugame_DefaultOrganization_20230831122822.log
[2024-25-01 11:12:07 INFO]
************************************************** Graph **************************************************
7 Nodes:
679db19ae230629eff5b82fefc97acfc, 0.0,
db1d56f6dbbcc951d54e69b3bce23fb9, 1.0,
4e00ee798a7cdfe51ae7962cae57e608, 2.0,
96bfc7a8e9e76be3cdec6a706243b314, 3.0,
a1d357857b1286049df080eeb9653563, 4.0,
36cd01289c4492f6423d71d898e76134, 5.0,
764b7b2306f6a3ee28e5144c95deab00, 6.0,
9 Edges:
6cd46e638ebc07a812c5dd558f68b8af: 679db19ae230629eff5b82fefc97acfc -> 679db19ae230629eff5b82fefc97acfc (chief technology officer: write one or multiple files and make sure that every detail )
188e36dc418d7528d235201495b6fec8: 679db19ae230629eff5b82fefc97acfc -> db1d56f6dbbcc951d54e69b3bce23fb9 (chief technology officer: write one or multiple files and make sure that every detail )
98e78da69ac1249f4fe659dae5829580: db1d56f6dbbcc951d54e69b3bce23fb9 -> 4e00ee798a7cdfe51ae7962cae57e608 (code reviewer: the code provided is a good start for developing a gomoku ga)
5508d1c5ac8e1c0359bbdd6ba7c87d89: 4e00ee798a7cdfe51ae7962cae57e608 -> 96bfc7a8e9e76be3cdec6a706243b314 (code reviewer: the code provided is well-structured and follows good progra)
754ca90350d942f934775411666deec7: 96bfc7a8e9e76be3cdec6a706243b314 -> a1d357857b1286049df080eeb9653563 (code reviewer: the code provided is well-structured and follows good coding)
0391f5714d99cc404713479f1f5f4994: a1d357857b1286049df080eeb9653563 -> 36cd01289c4492f6423d71d898e76134 (software test engineer: software test engineer: **[start chat]**
[chatdev is a soft)
a2d0d0a414869e1f8ba0a87989d7af34: 36cd01289c4492f6423d71d898e76134 -> 36cd01289c4492f6423d71d898e76134 (software test engineer: based on the error message "an error occurred: module 'os' h)
bf81800eb96d4bae975d11f539882328: 36cd01289c4492f6423d71d898e76134 -> 36cd01289c4492f6423d71d898e76134 (software test engineer: software test engineer: **[start chat]**
[chatdev is a soft)
c0be33704654e701027729ce44f42f21: 36cd01289c4492f6423d71d898e76134 -> 764b7b2306f6a3ee28e5144c95deab00 (software test engineer: based on the error message you provided, the bug causing the)
************************************************** Graph **************************************************
[2024-25-01 11:12:07 INFO] ZOMBIE EDGES:
Zombie Edge 679db19ae230629eff5b82fefc97acfc -> 679db19ae230629eff5b82fefc97acfc Removed
Zombie Edge 36cd01289c4492f6423d71d898e76134 -> 36cd01289c4492f6423d71d898e76134 Removed
Zombie Edge 36cd01289c4492f6423d71d898e76134 -> 36cd01289c4492f6423d71d898e76134 Removed
[2024-25-01 11:12:07 INFO] ZOMBIE NODES:
[2024-25-01 11:12:07 INFO]
************************************************** Graph **************************************************
7 Nodes:
679db19ae230629eff5b82fefc97acfc, 0.0,
db1d56f6dbbcc951d54e69b3bce23fb9, 1.0,
4e00ee798a7cdfe51ae7962cae57e608, 2.0,
96bfc7a8e9e76be3cdec6a706243b314, 3.0,
a1d357857b1286049df080eeb9653563, 4.0,
36cd01289c4492f6423d71d898e76134, 5.0,
764b7b2306f6a3ee28e5144c95deab00, 6.0,
6 Edges:
188e36dc418d7528d235201495b6fec8: 679db19ae230629eff5b82fefc97acfc -> db1d56f6dbbcc951d54e69b3bce23fb9 (chief technology officer: write one or multiple files and make sure that every detail )
98e78da69ac1249f4fe659dae5829580: db1d56f6dbbcc951d54e69b3bce23fb9 -> 4e00ee798a7cdfe51ae7962cae57e608 (code reviewer: the code provided is a good start for developing a gomoku ga)
5508d1c5ac8e1c0359bbdd6ba7c87d89: 4e00ee798a7cdfe51ae7962cae57e608 -> 96bfc7a8e9e76be3cdec6a706243b314 (code reviewer: the code provided is well-structured and follows good progra)
754ca90350d942f934775411666deec7: 96bfc7a8e9e76be3cdec6a706243b314 -> a1d357857b1286049df080eeb9653563 (code reviewer: the code provided is well-structured and follows good coding)
0391f5714d99cc404713479f1f5f4994: a1d357857b1286049df080eeb9653563 -> 36cd01289c4492f6423d71d898e76134 (software test engineer: software test engineer: **[start chat]**
[chatdev is a soft)
c0be33704654e701027729ce44f42f21: 36cd01289c4492f6423d71d898e76134 -> 764b7b2306f6a3ee28e5144c95deab00 (software test engineer: based on the error message you provided, the bug causing the)
************************************************** Graph **************************************************
[2024-25-01 11:12:28 INFO] Init value:{'679db19ae230629eff5b82fefc97acfc': 0.0, 'db1d56f6dbbcc951d54e69b3bce23fb9': 0.0, '4e00ee798a7cdfe51ae7962cae57e608': 0.0, '96bfc7a8e9e76be3cdec6a706243b314': 0.0, 'a1d357857b1286049df080eeb9653563': 0.0, '36cd01289c4492f6423d71d898e76134': 0.0, '764b7b2306f6a3ee28e5144c95deab00': 0.0}
Estimated value:{'679db19ae230629eff5b82fefc97acfc': 0.0, 'db1d56f6dbbcc951d54e69b3bce23fb9': 0.0, '4e00ee798a7cdfe51ae7962cae57e608': 0.0, '96bfc7a8e9e76be3cdec6a706243b314': 0.0, 'a1d357857b1286049df080eeb9653563': 0.0, '36cd01289c4492f6423d71d898e76134': 0.0, '764b7b2306f6a3ee28e5144c95deab00': 0.0}
[2024-25-01 11:12:28 INFO] 5 experieces truncated.
[2024-25-01 11:12:36 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:12:36 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1658
completion_tokens: 547
total_tokens: 2205
[2024-25-01 11:12:41 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:12:41 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1837
completion_tokens: 334
total_tokens: 2171
[2024-25-01 11:12:49 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:12:49 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1859
completion_tokens: 444
total_tokens: 2303
[2024-25-01 11:12:55 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:12:55 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1871
completion_tokens: 365
total_tokens: 2236
[2024-25-01 11:13:02 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:13:02 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1874
completion_tokens: 565
total_tokens: 2439
[2024-25-01 11:13:07 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:13:07 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1850
completion_tokens: 388
total_tokens: 2238
[2024-25-01 11:13:12 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:13:12 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1872
completion_tokens: 212
total_tokens: 2084
[2024-25-01 11:13:17 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:13:17 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1884
completion_tokens: 304
total_tokens: 2188
[2024-25-01 11:13:22 INFO] HTTP Request: POST https://yeysai.com/v1/chat/completions "HTTP/1.1 200 OK"
[2024-25-01 11:13:22 INFO] InstructionStar generation:
**[OpenAI_Usage_Info Receive]**
prompt_tokens: 1887
completion_tokens: 385
total_tokens: 2272

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,51 +0,0 @@
'''
This file handles the game logic for the Gomoku game.
'''
import pygame
class Board:
def __init__(self, rows, cols, player_1_icon, player_2_icon, width, height):
self.rows = rows
self.cols = cols
self.width = width
self.height = height
self.board = [[None for _ in range(cols)] for _ in range(rows)]
self.current_player = 1
self.player_1_icon = player_1_icon
self.player_2_icon = player_2_icon
self.game_state = 'ongoing'
self.winner = None
def place_stone(self, x, y):
if self.game_state == 'ended':
return
row, col = self.get_board_position(x, y)
if row >= 0 and row < self.rows and col >= 0 and col < self.cols:
if self.board[row][col] is None:
self.board[row][col] = self.current_player
if self.check_win(row, col):
self.game_state = 'ended'
self.winner = self.current_player
self.current_player = 1 if self.current_player == 2 else 2
def get_board_position(self, x, y):
row = y // (self.height // self.rows)
col = x // (self.width // self.cols)
return row, col
def check_win(self, row, col):
# Check horizontal, vertical and diagonal lines for a win
directions = [(0, 1), (1, 0), (1, 1), (1, -1)]
for dx, dy in directions:
if self.count_stones(row, col, dx, dy) + self.count_stones(row, col, -dx, -dy) - 1 >= 5:
return True
return False
def count_stones(self, row, col, dx, dy):
count = 0
while 0 <= row < self.rows and 0 <= col < self.cols and self.board[row][col] == self.current_player:
count += 1
row += dx
col += dy
return count
def draw(self, window):
for row in range(self.rows):
for col in range(self.cols):
if self.board[row][col] is not None:
icon = self.player_1_icon if self.board[row][col] == 1 else self.player_2_icon
window.blit(icon, (col * (self.width // self.cols), row * (self.height // self.rows)))

View File

@ -1,45 +0,0 @@
'''
This is the main file for the Gomoku game. It handles the game loop and user interaction.
'''
import pygame
import board
import os
from pygame import image, font
# Initialize Pygame
pygame.init()
# Set the width and height of the game window
WIDTH, HEIGHT = 800, 800
# Set the dimensions of the game board
BOARD_ROWS, BOARD_COLS = 15, 15
# Create the game window
WINDOW = pygame.display.set_mode((WIDTH, HEIGHT))
# Load images
bg_image = image.load('board_background.png')
player_1_icon = image.load('player_1_icon.png')
player_2_icon = image.load('player_2_icon.png')
# Create a game board
game_board = board.Board(BOARD_ROWS, BOARD_COLS, player_1_icon, player_2_icon, WIDTH, HEIGHT)
# Create a font object
font = font.Font(None, 36)
def main():
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN and game_board.game_state == 'ongoing':
x, y = pygame.mouse.get_pos()
game_board.place_stone(x, y)
WINDOW.blit(bg_image, (0, 0))
game_board.draw(WINDOW)
text = font.render(f"Player {game_board.current_player}'s turn", True, (255, 255, 255))
WINDOW.blit(text, (20, 20))
if game_board.game_state == 'ended':
text = font.render(f"Player {game_board.winner} wins!", True, (255, 255, 255))
WINDOW.blit(text, (WIDTH // 2 - text.get_width() // 2, HEIGHT // 2 - text.get_height() // 2))
pygame.display.update()
clock.tick(60)
pygame.quit()
if __name__ == "__main__":
main()

View File

@ -168,11 +168,12 @@ After this process, the experiences have been extracted from the production of s
- `<directory>`: The file path to the memory directory that you intend to process.
- `<filtered_directory>`: The file path to a directory where you want to store the processed data.
\
**For example:**
```bash
python3 ecl/post_process/memory_filter.py 0.5 "ecl/memory/MemoryCards.json" "ecl/memory/MemoryCards_filtered.json"
python3 ecl/post_process/memory_filter.py 0.9 "ecl/memory/MemoryCards.json" "ecl/memory/MemoryCards_filtered.json"
```
> **Notice:** Actually, we have provided our `MemoryCards.json` used in our experiment in *link*. You can download the json file and put it in `ecl/memory` folder. This allows you to directly proceed to the Co-Reasoning phase without needing to redo the Co-Tracking and Co-Memorizing steps.
> **Notice:** By default, the `MemoryCards.json` is set to be empty. You can customize your own experience pool for agents following steps above. And we have also provided our `MemoryCards.json` used in our experiment in [MemoryCards.json](https://drive.google.com/drive/folders/1czsR4swQyqpoN8zwN0-rSFcTVl68zTDY?usp=sharing). You can download the json file through the link and put it under `ecl/memory` folder. This allows you to directly proceed to the Co-Reasoning phase without needing to redo the Co-Tracking and Co-Memorizing steps.
### Co-Reasoning
- **Memory Usage Configuration**:
In the `CompanyConfig/Default/ChatChainConfig.json` file, the `with_memory` option should be set **True**. \
@ -184,7 +185,7 @@ After this process, the experiences have been extracted from the production of s
```
In this process of software development, the agents will engage their experience pool(`MemoryCards.json`) into software development!
If you are interested in this **Experiential Co-Learning** Module, please checkout our preprint paper at https://arxiv.org/abs/2312.17025.
Detailed descriptions and experiment results about this **Experiential Co-Learning** Module lies in our preprint paper at https://arxiv.org/abs/2312.17025.
## Customization