Skip to content

Commit 8a94478

Browse files
committed
Fix instructions
1 parent 88cfe88 commit 8a94478

14 files changed

Lines changed: 115 additions & 92 deletions

File tree

benchmark/advanced/multi_class_database_system/.docs/detailed_instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,6 @@ Your solution should demonstrate:
180180
- **Horizontal scaling**: Design that supports multiple database instances
181181
- **Performance monitoring**: Built-in metrics for system optimization
182182

183-
This exercise tests the LLM's ability to design and implement sophisticated internal architecture while maintaining a clean, simple public interface - a hallmark of professional enterprise software design.
183+
## Re-using Components and Existing Code
184+
Please reuse the cache_manager.h, cache_manager.cpp, connection_pool.h, connection_pool.cpp, query_optimizer.h. query_optimizer.cpp, result_processor.h, result_processor.cpp, transaction_manager.h and transaction_manager.cpp files.
185+
You may create additional classes and functions as needed to implement the required functionality.

benchmark/advanced/multi_class_database_system/.docs/instructions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ std::string execute_database_operation(const std::string& operation_type,
3232
- `execute_database_operation("TRANSACTION", "BEGIN", {})` should start a transaction
3333
3434
**Hint:** Create instances of all manager classes, then coordinate them based on operation type.
35+
36+
37+
## Re-using Components and Existing Code
38+
Please reuse the cache_manager.h, cache_manager.cpp, connection_pool.h, connection_pool.cpp, query_optimizer.h. query_optimizer.cpp, result_processor.h, result_processor.cpp, transaction_manager.h and transaction_manager.cpp files.
39+
You may create additional classes and functions as needed to implement the required functionality.

benchmark/advanced/multi_class_design/.docs/detailed_instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ auto hex = convert_base(dec, 10, 16); // Should return {15, 15} (FF in hex)
5656
- Create appropriate abstractions for validation and conversion logic
5757
- Ensure your code is well-structured and maintainable
5858
- Handle all edge cases gracefully
59+
60+
## Re-using Components and Existing Code
61+
Please reuse the base_converter.h, base_converter.cpp, base_validator.h, and base_validator.cpp files.
62+
You may create additional classes and functions as needed to implement the required functionality.

benchmark/advanced/multi_class_design/.docs/simple_instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ std::vector<int> convert_base(const std::vector<int>& digits,
2222
int input_base,
2323
int output_base);
2424
```
25+
26+
## Re-using Components and Existing Code
27+
Please reuse the base_converter.h, base_converter.cpp, base_validator.h, and base_validator.cpp files.
28+
You may create additional classes and functions as needed to implement the required functionality.

benchmark/advanced/multi_class_design/base_converter.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@ std::vector<int> BaseConverter::convert(const std::vector<int>& digits,
1010
int output_base) const {
1111
// Validate input parameters
1212
if (!validator_.is_valid_base(input_base)) {
13-
throw std::invalid_argument("input base must be >= 2");
13+
throw std::invalid_argument("Input base must be >= 2");
1414
}
1515
if (!validator_.is_valid_base(output_base)) {
16-
throw std::invalid_argument("output base must be >= 2");
16+
throw std::invalid_argument("Output base must be >= 2");
1717
}
18+
19+
// Check for negative digits first (specific error message)
20+
for (int digit : digits) {
21+
if (digit < 0) {
22+
throw std::invalid_argument("Negative digits are not allowed");
23+
}
24+
}
25+
26+
// Then check if digits are valid for the base
1827
if (!validator_.are_digits_valid_for_base(digits, input_base)) {
19-
throw std::invalid_argument("all digits must be valid for the input base");
28+
throw std::invalid_argument("All digits must be valid for the input base");
2029
}
2130

2231
// Handle zero case
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
#include "multi_class_design.h"
12
#include "base_validator.h"
23
#include "base_converter.h"
3-
#include <vector>
4-
#include <stdexcept>
54

65
namespace multi_class_design {
76

87
// TODO: add your solution here
9-
108
} // namespace multi_class_design
Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,19 @@
1+
#include "multi_class_design.h"
12
#include "base_validator.h"
23
#include "base_converter.h"
3-
#include <vector>
4-
#include <stdexcept>
54

65
namespace multi_class_design {
76

8-
std::vector<int> convert_base(const std::vector<int>& digits, int input_base, int output_base) {
9-
// Create validator instance for extensive validation
10-
BaseValidator validator;
11-
12-
// Perform explicit validation with specific error messages
13-
if (!validator.is_valid_base(input_base)) {
14-
throw std::invalid_argument("Input base must be >= 2");
15-
}
16-
17-
if (!validator.is_valid_base(output_base)) {
18-
throw std::invalid_argument("Output base must be >= 2");
19-
}
20-
21-
// Check for negative digits specifically
22-
for (int digit : digits) {
23-
if (digit < 0) {
24-
throw std::invalid_argument("Negative digits are not allowed");
25-
}
26-
}
27-
28-
// Validate digits for the input base
29-
if (!validator.are_digits_valid_for_base(digits, input_base)) {
30-
throw std::invalid_argument("All digits must be valid for the input base");
31-
}
32-
33-
// Handle zero sequence explicitly
34-
if (validator.is_zero_sequence(digits)) {
35-
return {0};
36-
}
37-
38-
// Create converter with validator and perform conversion
39-
BaseConverter converter(validator);
40-
return converter.convert(digits, input_base, output_base);
41-
}
7+
std::vector<int> convert_base(const std::vector<int>& digits,
8+
int input_base,
9+
int output_base) {
10+
// Create validator and converter instances
11+
BaseValidator validator;
12+
BaseConverter converter(validator);
13+
14+
// Use the converter to perform the conversion
15+
// The converter handles all validation and conversion logic
16+
return converter.convert(digits, input_base, output_base);
17+
}
4218

4319
} // namespace multi_class_design

benchmark/advanced/multi_class_design_two/.docs/detailed_instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,7 @@ Your solution should demonstrate:
106106
- Coordinated workflow between processing components
107107
- Professional error handling and user feedback
108108
- Maintainable and extensible code structure
109+
110+
## Re-using Components and Existing Code
111+
Please reuse the report_generator.cpp, report_generator.h, content_analyzer.h, content_analyzer.cpp, document_processor.h and document_processor.h files.
112+
You may create additional classes and functions as needed to implement the required functionality.

benchmark/advanced/multi_class_design_two/.docs/simple_instructions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ Implement the following function:
3737
```cpp
3838
std::string analyze_document(const std::string& document_text,
3939
const std::string& analysis_type);
40-
```
40+
```
41+
42+
## Re-using Components and Existing Code
43+
Please reuse the report_generator.cpp, report_generator.h, content_analyzer.h, content_analyzer.cpp, document_processor.h and document_processor.h files.
44+
You may create additional classes and functions as needed to implement the required functionality.

benchmark/advanced/multi_class_media_processing_system/.docs/detailed_instructions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,8 @@ private:
231231
5. Test each component thoroughly using the provided test suite
232232
233233
The CodecManager is your foundation - study its interface and use it effectively in your implementations!
234+
235+
236+
## Re-using Components and Existing Code
237+
Please reuse the codec_manager.cpp and codec_manager.h files.
238+
You may create additional classes and functions as needed to implement the required functionality.

0 commit comments

Comments
 (0)