minor changes (format + move class in stl package )
This commit is contained in:
295
ArtLogJavaFormat.xml
Normal file
295
ArtLogJavaFormat.xml
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<profiles version="12">
|
||||||
|
<profile kind="CodeFormatterProfile" name="ArtLog" version="12">
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
42
build.xml
Normal file
42
build.xml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<project name="artloglaby" default="dist" basedir="/home/philippe/artisanlogiciel/code/java/laby_github">
|
||||||
|
<description>
|
||||||
|
simple example build file
|
||||||
|
</description>
|
||||||
|
<!-- set global properties for this build -->
|
||||||
|
<property name="src" location="java"/>
|
||||||
|
<property name="build" location="build"/>
|
||||||
|
<property name="dist" location="dist"/>
|
||||||
|
|
||||||
|
<target name="init">
|
||||||
|
<!-- Create the time stamp -->
|
||||||
|
<tstamp/>
|
||||||
|
<!-- Create the build directory structure used by compile -->
|
||||||
|
<mkdir dir="${build}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" depends="init"
|
||||||
|
description="compile the source " >
|
||||||
|
<!-- Compile the java code from ${src} into ${build} -->
|
||||||
|
<javac srcdir="${src}" destdir="${build}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="dist" depends="compile"
|
||||||
|
description="generate the distribution" >
|
||||||
|
<!-- Create the distribution directory -->
|
||||||
|
<mkdir dir="${dist}/lib"/>
|
||||||
|
|
||||||
|
<!-- Put everything in ${build} into the artloglaby-0.0.1.jar file ( ${DSTAMP} not used yet )-->
|
||||||
|
<jar jarfile="${dist}/lib/artloglaby-0.0.1.jar" basedir="${build}">
|
||||||
|
<manifest>
|
||||||
|
<attribute name="Main-Class" value="org.artisanlogiciel.games.Display"/>
|
||||||
|
</manifest>
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean"
|
||||||
|
description="clean up" >
|
||||||
|
<!-- Delete the ${build} and ${dist} directory trees -->
|
||||||
|
<delete dir="${build}"/>
|
||||||
|
<delete dir="${dist}"/>
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
40
documentation/rawformat
Normal file
40
documentation/rawformat
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
Maze/Labyrinth raw format extension .raw
|
||||||
|
|
||||||
|
Model of labyrinth storing only paths not walls. wall are regenerated later on based on adjacent paths.
|
||||||
|
each position (x,y) stores what move can be done from here to go do deeper path.
|
||||||
|
a node is tagged OPEN and contained in openList if all moves from its position have not been resolved
|
||||||
|
a node is tagged CLOSED when fully processed
|
||||||
|
|
||||||
|
position is (x,y)
|
||||||
|
|
||||||
|
See org.artisanlogiciel.games.WallsProvider
|
||||||
|
|
||||||
|
file starts with
|
||||||
|
'LAB0'
|
||||||
|
32bits Width
|
||||||
|
32bits Height
|
||||||
|
|
||||||
|
Width * ( 16bits )
|
||||||
|
*
|
||||||
|
Height.
|
||||||
|
|
||||||
|
|
||||||
|
/** WARNING don't change those values, they are used as it is for optimisation */
|
||||||
|
private final static short FLAGLENGTH=7;
|
||||||
|
private final static short CLEAR=0; // mandatory 0 since array creation is initialized with 0.
|
||||||
|
private final static short HORIZONTAL=1;
|
||||||
|
private final static short VERTICAL=2;
|
||||||
|
private final static short DIRECTION=4; // could we get rid of that to free one bit for other purpose ?
|
||||||
|
private final static short POSITIVE=8;
|
||||||
|
private final static short NEGATIVE=16;
|
||||||
|
private final static short OPEN=32; // can be reused once generation is completed
|
||||||
|
private final static short CLOSED=64; // can be reused once generation is completed
|
||||||
|
private final static short LEFT=Brick.LEFT<<FLAGLENGTH|DIRECTION|HORIZONTAL|NEGATIVE;
|
||||||
|
private final static short DOWN=Brick.DOWN<<FLAGLENGTH|DIRECTION|VERTICAL|POSITIVE;
|
||||||
|
private final static short RIGHT=Brick.RIGHT<<FLAGLENGTH|DIRECTION|HORIZONTAL|POSITIVE;
|
||||||
|
private final static short UP=Brick.UP<<FLAGLENGTH|DIRECTION|VERTICAL|NEGATIVE;
|
||||||
|
private final static short ENTRY=Brick.ENTRY<<FLAGLENGTH; // flag when a wall should be open to access this.
|
||||||
|
private final static short GOAL=Brick.GOAL<<FLAGLENGTH; // flag when a wall should be open to access this.
|
||||||
|
private final static short SOLVED=64<<FLAGLENGTH; // flag when solution is on this path.
|
||||||
|
private final static short FREE=128<<FLAGLENGTH; // free flag
|
||||||
@@ -7,6 +7,7 @@ $(OUT):
|
|||||||
mkdir -p $(OUT)
|
mkdir -p $(OUT)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@find $(PACKAGE_DIR) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null && echo "cleaned classes in source"
|
||||||
@find $(OUT) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null || echo "nothing to clean"
|
@find $(OUT) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null || echo "nothing to clean"
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ a is 'H' or '.' or ' '
|
|||||||
bcd is 'H' or ' '
|
bcd is 'H' or ' '
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class Brick {
|
public class Brick
|
||||||
|
{
|
||||||
|
|
||||||
public final static short LEFT = 1;
|
public final static short LEFT = 1;
|
||||||
public final static short DOWN = 2;
|
public final static short DOWN = 2;
|
||||||
@@ -65,22 +66,12 @@ public class Brick {
|
|||||||
String s = "";
|
String s = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dir[LEFT | DOWN | RIGHT | UP]='O';
|
* dir[LEFT | DOWN | RIGHT | UP]='O'; dir[LEFT | DOWN | RIGHT]='U';
|
||||||
dir[LEFT | DOWN | RIGHT]='U';
|
* dir[LEFT | UP | RIGHT]='M'; dir[LEFT | UP | DOWN]='['; dir[RIGHT | UP
|
||||||
dir[LEFT | UP | RIGHT]='M';
|
* | DOWN]=']'; dir[UP | DOWN]='='; dir[LEFT | RIGHT]='|'; dir[RIGHT |
|
||||||
dir[LEFT | UP | DOWN]='[';
|
* DOWN]='J'; dir[LEFT | DOWN]='L'; dir [LEFT | UP]='T'; dir[UP |
|
||||||
dir[RIGHT | UP | DOWN]=']';
|
* RIGHT]='7'; dir[LEFT] = '!'; dir[RIGHT] ='|'; dir[DOWN]= '_';
|
||||||
dir[UP | DOWN]='=';
|
* dir[UP]= '¨'; dir[0]=' ';
|
||||||
dir[LEFT | RIGHT]='|';
|
|
||||||
dir[RIGHT | DOWN]='J';
|
|
||||||
dir[LEFT | DOWN]='L';
|
|
||||||
dir [LEFT | UP]='T';
|
|
||||||
dir[UP | RIGHT]='7';
|
|
||||||
dir[LEFT] = '!';
|
|
||||||
dir[RIGHT] ='|';
|
|
||||||
dir[DOWN]= '_';
|
|
||||||
dir[UP]= '¨';
|
|
||||||
dir[0]=' ';
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dir[LEFT | DOWN | RIGHT | UP] = 'O';
|
dir[LEFT | DOWN | RIGHT | UP] = 'O';
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import javax.swing.KeyStroke;
|
|||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
|
import org.artisanlogiciel.games.stl.Wall3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display
|
* Display
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ package org.artisanlogiciel.games;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
class LabyMap
|
class LabyMap implements WallsProvider
|
||||||
implements WallsProvider
|
|
||||||
{
|
{
|
||||||
|
|
||||||
Brick[][] tileMap;
|
Brick[][] tileMap;
|
||||||
@@ -51,15 +50,28 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String laby = "H";
|
String laby = "H";
|
||||||
for ( int x=0; x < tileMap.length; x ++) {
|
for (int x = 0; x < tileMap.length; x++)
|
||||||
if ( entryX == x ) { laby += " H" ; }
|
{
|
||||||
else { laby+="HH";}
|
if (entryX == x)
|
||||||
|
{
|
||||||
|
laby += " H";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
laby += "HH";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
laby += "\n";
|
laby += "\n";
|
||||||
for (int y = 0; y < tileMap[0].length; y++)
|
for (int y = 0; y < tileMap[0].length; y++)
|
||||||
{
|
{
|
||||||
if ( entryY == y ) { laby += ">";}
|
if (entryY == y)
|
||||||
else { laby += "H"; }
|
{
|
||||||
|
laby += ">";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
laby += "H";
|
||||||
|
}
|
||||||
for (int x = 0; x < tileMap.length; x++)
|
for (int x = 0; x < tileMap.length; x++)
|
||||||
{
|
{
|
||||||
laby += tileMap[x][y].getUpString();
|
laby += tileMap[x][y].getUpString();
|
||||||
@@ -75,7 +87,6 @@ implements WallsProvider
|
|||||||
return laby;
|
return laby;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toShortString()
|
public String toShortString()
|
||||||
{
|
{
|
||||||
int entryX = -1;
|
int entryX = -1;
|
||||||
|
|||||||
@@ -12,32 +12,48 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Model of labyrinth storing only paths not walls. wall are regenerated later on based on adjacent paths.
|
* Model of labyrinth storing only paths not walls. wall are regenerated later
|
||||||
each position (x,y) stores what move can be done from here to go do deeper path.
|
* on based on adjacent paths. each position (x,y) stores what move can be done
|
||||||
a node is tagged OPEN and contained in openList if all moves from its position have not been resolved
|
* from here to go do deeper path. a node is tagged OPEN and contained in
|
||||||
a node is tagged CLOSED when fully processed
|
* openList if all moves from its position have not been resolved a node is
|
||||||
|
* tagged CLOSED when fully processed
|
||||||
**/
|
**/
|
||||||
public class LabyModel
|
public class LabyModel implements WallsProvider
|
||||||
implements WallsProvider
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/** WARNING don't change those values, they are used as it is for optimisation */
|
/**
|
||||||
|
* WARNING don't change those values, they are used as it is for
|
||||||
|
* optimisation
|
||||||
|
*/
|
||||||
private final static short FLAGLENGTH = 7;
|
private final static short FLAGLENGTH = 7;
|
||||||
private final static short CLEAR=0; // mandatory 0 since array creation is initialized with 0.
|
private final static short CLEAR = 0; // mandatory 0 since array creation is
|
||||||
|
// initialized with 0.
|
||||||
private final static short HORIZONTAL = 1;
|
private final static short HORIZONTAL = 1;
|
||||||
private final static short VERTICAL = 2;
|
private final static short VERTICAL = 2;
|
||||||
private final static short DIRECTION=4; // could we get rid of that to free one bit for other purpose ?
|
private final static short DIRECTION = 4; // could we get rid of that to
|
||||||
|
// free one bit for other purpose
|
||||||
|
// ?
|
||||||
private final static short POSITIVE = 8;
|
private final static short POSITIVE = 8;
|
||||||
private final static short NEGATIVE = 16;
|
private final static short NEGATIVE = 16;
|
||||||
private final static short OPEN=32; // can be reused once generation is completed
|
private final static short OPEN = 32; // can be reused once generation is
|
||||||
private final static short CLOSED=64; // can be reused once generation is completed
|
// completed
|
||||||
|
private final static short CLOSED = 64; // can be reused once generation is
|
||||||
|
// completed
|
||||||
private final static short LEFT = Brick.LEFT << FLAGLENGTH | DIRECTION | HORIZONTAL | NEGATIVE;
|
private final static short LEFT = Brick.LEFT << FLAGLENGTH | DIRECTION | HORIZONTAL | NEGATIVE;
|
||||||
private final static short DOWN = Brick.DOWN << FLAGLENGTH | DIRECTION | VERTICAL | POSITIVE;
|
private final static short DOWN = Brick.DOWN << FLAGLENGTH | DIRECTION | VERTICAL | POSITIVE;
|
||||||
private final static short RIGHT = Brick.RIGHT << FLAGLENGTH | DIRECTION | HORIZONTAL | POSITIVE;
|
private final static short RIGHT = Brick.RIGHT << FLAGLENGTH | DIRECTION | HORIZONTAL | POSITIVE;
|
||||||
private final static short UP = Brick.UP << FLAGLENGTH | DIRECTION | VERTICAL | NEGATIVE;
|
private final static short UP = Brick.UP << FLAGLENGTH | DIRECTION | VERTICAL | NEGATIVE;
|
||||||
private final static short ENTRY=Brick.ENTRY<<FLAGLENGTH; // flag when a wall should be open to access this.
|
private final static short ENTRY = Brick.ENTRY << FLAGLENGTH; // flag when a
|
||||||
private final static short GOAL=Brick.GOAL<<FLAGLENGTH; // flag when a wall should be open to access this.
|
// wall should
|
||||||
private final static short SOLVED=64<<FLAGLENGTH; // flag when solution is on this path.
|
// be open to
|
||||||
|
// access
|
||||||
|
// this.
|
||||||
|
private final static short GOAL = Brick.GOAL << FLAGLENGTH; // flag when a
|
||||||
|
// wall should
|
||||||
|
// be open to
|
||||||
|
// access this.
|
||||||
|
private final static short SOLVED = 64 << FLAGLENGTH; // flag when solution
|
||||||
|
// is on this path.
|
||||||
private final static short FREE = 128 << FLAGLENGTH; // free flag
|
private final static short FREE = 128 << FLAGLENGTH; // free flag
|
||||||
// remains 2 free bits ( keep one out for sign )
|
// remains 2 free bits ( keep one out for sign )
|
||||||
|
|
||||||
@@ -47,9 +63,10 @@ implements WallsProvider
|
|||||||
private int height;
|
private int height;
|
||||||
private short[][] t;
|
private short[][] t;
|
||||||
private int depth = 0;
|
private int depth = 0;
|
||||||
/** will enforce maxdepth as maxium length of path in depth first.
|
/**
|
||||||
It means that after every maxdepth moves there should be crossing paths.
|
* will enforce maxdepth as maximum length of path in depth first. It means
|
||||||
I think that to shorter maxdepth is the harder the labyrinth is ...
|
* that after every maxdepth moves there should be crossing paths. I think
|
||||||
|
* that to shorter maxdepth is the harder the labyrinth is ...
|
||||||
**/
|
**/
|
||||||
private int maxdepth = 0;
|
private int maxdepth = 0;
|
||||||
private int deepest = 0; // longest path found
|
private int deepest = 0; // longest path found
|
||||||
@@ -60,12 +77,15 @@ implements WallsProvider
|
|||||||
private final LinkedList<Position> openList = new LinkedList<Position>();
|
private final LinkedList<Position> openList = new LinkedList<Position>();
|
||||||
// list of entries and exits.
|
// list of entries and exits.
|
||||||
private final LinkedList<Position> entryExits = new LinkedList<Position>();
|
private final LinkedList<Position> entryExits = new LinkedList<Position>();
|
||||||
private final Object coherentLock = new Object(); // before getting the lock and after lock release all is coherent ( ie check() is ok ),
|
private final Object coherentLock = new Object(); // before getting the lock
|
||||||
|
// and after lock release
|
||||||
|
// all is coherent ( ie
|
||||||
|
// check() is ok ),
|
||||||
|
|
||||||
MazeCreationListener listener = null;
|
MazeCreationListener listener = null;
|
||||||
|
|
||||||
|
public LabyModel(int width, int height, int maxdepth, Random random)
|
||||||
public LabyModel(int width, int height,int maxdepth, Random random){
|
{
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.maxdepth = maxdepth;
|
this.maxdepth = maxdepth;
|
||||||
@@ -74,7 +94,8 @@ implements WallsProvider
|
|||||||
t = new short[width][height];
|
t = new short[width][height];
|
||||||
}
|
}
|
||||||
|
|
||||||
public LabyModel(MazeParams params, Random random){
|
public LabyModel(MazeParams params, Random random)
|
||||||
|
{
|
||||||
this.width = params.getWidth();
|
this.width = params.getWidth();
|
||||||
this.height = params.getHeight();
|
this.height = params.getHeight();
|
||||||
this.maxdepth = params.getMaxDepth();
|
this.maxdepth = params.getMaxDepth();
|
||||||
@@ -83,8 +104,7 @@ implements WallsProvider
|
|||||||
t = new short[width][height];
|
t = new short[width][height];
|
||||||
}
|
}
|
||||||
|
|
||||||
public LabyModel(String pFormat, InputStream pIn)
|
public LabyModel(String pFormat, InputStream pIn) throws IOException
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
parseInputStream(pFormat, pIn);
|
parseInputStream(pFormat, pIn);
|
||||||
}
|
}
|
||||||
@@ -128,14 +148,16 @@ implements WallsProvider
|
|||||||
{
|
{
|
||||||
System.out.print(".");
|
System.out.print(".");
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
System.out.print(" ");
|
System.out.print(" ");
|
||||||
}
|
}
|
||||||
// don't display information about short.
|
// don't display information about short.
|
||||||
direction &= ~OPEN;
|
direction &= ~OPEN;
|
||||||
direction &= ~GOAL;
|
direction &= ~GOAL;
|
||||||
direction &= ~CLOSED;
|
direction &= ~CLOSED;
|
||||||
switch(direction){
|
switch (direction)
|
||||||
|
{
|
||||||
case LEFT: // left
|
case LEFT: // left
|
||||||
System.out.print("<-");
|
System.out.print("<-");
|
||||||
break;
|
break;
|
||||||
@@ -203,8 +225,7 @@ implements WallsProvider
|
|||||||
System.out.print("..");
|
System.out.print("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( (t[x][y] & RIGHT) == RIGHT ) ||
|
if (((t[x][y] & RIGHT) == RIGHT) || ((x + 1 < width) && ((t[x + 1][y] & LEFT) == LEFT)))
|
||||||
( ( x+ 1 < width) && ( ( t[x+1][y] & LEFT ) == LEFT ) ))
|
|
||||||
{
|
{
|
||||||
System.out.print("-");
|
System.out.print("-");
|
||||||
}
|
}
|
||||||
@@ -261,7 +282,8 @@ implements WallsProvider
|
|||||||
direction &= ~GOAL;
|
direction &= ~GOAL;
|
||||||
direction &= ~CLOSED;
|
direction &= ~CLOSED;
|
||||||
direction &= ~SOLVED;
|
direction &= ~SOLVED;
|
||||||
switch(direction){
|
switch (direction)
|
||||||
|
{
|
||||||
case LEFT:
|
case LEFT:
|
||||||
case DOWN:
|
case DOWN:
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
@@ -303,7 +325,6 @@ implements WallsProvider
|
|||||||
low = ".";
|
low = ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Position exit : entryExits)
|
for (Position exit : entryExits)
|
||||||
{
|
{
|
||||||
if ((exit.getX() == x + 1) && (exit.getY() == y))
|
if ((exit.getX() == x + 1) && (exit.getY() == y))
|
||||||
@@ -313,8 +334,7 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( (t[x][y] & RIGHT) == RIGHT ) ||
|
if (((t[x][y] & RIGHT) == RIGHT) || ((x + 1 < width) && ((t[x + 1][y] & LEFT) == LEFT)))
|
||||||
( ( x+ 1 < width) && ( ( t[x+1][y] & LEFT ) == LEFT ) ))
|
|
||||||
{
|
{
|
||||||
low = low + freeway;
|
low = low + freeway;
|
||||||
}
|
}
|
||||||
@@ -342,11 +362,13 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth(){
|
public int getWidth()
|
||||||
|
{
|
||||||
return this.width;
|
return this.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeight(){
|
public int getHeight()
|
||||||
|
{
|
||||||
return this.height;
|
return this.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,10 +402,10 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
check model coherency and fix
|
* check model coherency and fix if model needed a fix it means that
|
||||||
if model needed a fix it means that algorithm has a problem
|
* algorithm has a problem
|
||||||
|
*
|
||||||
@return true if model is ok and no fix was applied.
|
* @return true if model is ok and no fix was applied.
|
||||||
**/
|
**/
|
||||||
public boolean check()
|
public boolean check()
|
||||||
{
|
{
|
||||||
@@ -406,7 +428,8 @@ implements WallsProvider
|
|||||||
t[x][y] &= ~CLOSED;
|
t[x][y] &= ~CLOSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// should do reverse : every node tagged OPEN should be in open list.
|
// should do reverse : every node tagged OPEN should be in open
|
||||||
|
// list.
|
||||||
// a little more cpu consuming...
|
// a little more cpu consuming...
|
||||||
}
|
}
|
||||||
return check;
|
return check;
|
||||||
@@ -432,7 +455,8 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateWithEntry(int x, int y){
|
public void generateWithEntry(int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
openList.add(new Position(x, y));
|
openList.add(new Position(x, y));
|
||||||
while (!openList.isEmpty())
|
while (!openList.isEmpty())
|
||||||
@@ -489,8 +513,9 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param p Position
|
* @param p
|
||||||
@return true if newly added , false if already open.
|
* Position
|
||||||
|
* @return true if newly added , false if already open.
|
||||||
**/
|
**/
|
||||||
private boolean open(boolean first, Position p)
|
private boolean open(boolean first, Position p)
|
||||||
{
|
{
|
||||||
@@ -506,7 +531,7 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
resolve this labrynth using internal representation
|
* resolve this labrynth using internal representation
|
||||||
**/
|
**/
|
||||||
public LinkedList<Position> resolve(int x, int y, MazeResolutionListener rlistener)
|
public LinkedList<Position> resolve(int x, int y, MazeResolutionListener rlistener)
|
||||||
{
|
{
|
||||||
@@ -524,34 +549,60 @@ implements WallsProvider
|
|||||||
// should find from all direction one that point to this.
|
// should find from all direction one that point to this.
|
||||||
ArrayList<Short> freeDirection = new ArrayList<Short>();
|
ArrayList<Short> freeDirection = new ArrayList<Short>();
|
||||||
|
|
||||||
for (int didx=0; didx < 4; didx ++ ) {
|
for (int didx = 0; didx < 4; didx++)
|
||||||
|
{
|
||||||
int delta = 0;
|
int delta = 0;
|
||||||
short direction = AllDirections[didx];
|
short direction = AllDirections[didx];
|
||||||
short reversedirection = AllDirections[(didx + 2) % 4];
|
short reversedirection = AllDirections[(didx + 2) % 4];
|
||||||
short pointingdirection = DIRECTION;
|
short pointingdirection = DIRECTION;
|
||||||
|
|
||||||
if ( ( direction & POSITIVE ) == POSITIVE ) { delta = 1; pointingdirection |= NEGATIVE ; }
|
if ((direction & POSITIVE) == POSITIVE)
|
||||||
else { delta = -1; pointingdirection |= POSITIVE ;}
|
{
|
||||||
|
delta = 1;
|
||||||
|
pointingdirection |= NEGATIVE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delta = -1;
|
||||||
|
pointingdirection |= POSITIVE;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ( direction & HORIZONTAL ) == HORIZONTAL ) { newx = x + delta; newy = y; pointingdirection |= HORIZONTAL; }
|
if ((direction & HORIZONTAL) == HORIZONTAL)
|
||||||
else { newy = y + delta; newx = x; pointingdirection |= VERTICAL ;}
|
{
|
||||||
|
newx = x + delta;
|
||||||
|
newy = y;
|
||||||
|
pointingdirection |= HORIZONTAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newy = y + delta;
|
||||||
|
newx = x;
|
||||||
|
pointingdirection |= VERTICAL;
|
||||||
|
}
|
||||||
|
|
||||||
// internal GUARD.
|
// internal GUARD.
|
||||||
if ((reversedirection & pointingdirection) != pointingdirection)
|
if ((reversedirection & pointingdirection) != pointingdirection)
|
||||||
{
|
{
|
||||||
System.out.println("Internal ERROR. Please check AllDirections order " + ( reversedirection & pointingdirection ) + " " + pointingdirection );
|
System.out.println("Internal ERROR. Please check AllDirections order "
|
||||||
|
+ (reversedirection & pointingdirection) + " " + pointingdirection);
|
||||||
return backpath;
|
return backpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (newx >= 0) && ( newy >= 0 ) && (newx < width) && (newy < height) ) {
|
if ((newx >= 0) && (newy >= 0) && (newx < width) && (newy < height))
|
||||||
if ( ( t[newx][newy] & reversedirection ) == reversedirection){
|
{
|
||||||
if ( found != null ) {
|
if ((t[newx][newy] & reversedirection) == reversedirection)
|
||||||
|
{
|
||||||
|
if (found != null)
|
||||||
|
{
|
||||||
// could be a unique parent of two paths...
|
// could be a unique parent of two paths...
|
||||||
// but search from other entry/exits than generated from
|
// but search from other entry/exits than generated
|
||||||
// ie entry(0,0) exit(width-1,height-1) not yet implemented.
|
// from
|
||||||
|
// ie entry(0,0) exit(width-1,height-1) not yet
|
||||||
|
// implemented.
|
||||||
if (rlistener != null)
|
if (rlistener != null)
|
||||||
{
|
{
|
||||||
rlistener.notifySearchError("Model Error : two parents " + found.toString() + " " + new Position(newx,newy).toString());
|
rlistener.notifySearchError("Model Error : two parents " + found.toString() + " "
|
||||||
|
+ new Position(newx, newy).toString());
|
||||||
}
|
}
|
||||||
return backpath;
|
return backpath;
|
||||||
}
|
}
|
||||||
@@ -582,7 +633,7 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@returns wheter process closed current node.
|
* @returns wheter process closed current node.
|
||||||
**/
|
**/
|
||||||
public boolean step(int depth)
|
public boolean step(int depth)
|
||||||
{
|
{
|
||||||
@@ -610,19 +661,36 @@ implements WallsProvider
|
|||||||
// should find all free positions...
|
// should find all free positions...
|
||||||
ArrayList<Short> freeDirection = new ArrayList<Short>();
|
ArrayList<Short> freeDirection = new ArrayList<Short>();
|
||||||
|
|
||||||
for (short direction : AllDirections ) {
|
for (short direction : AllDirections)
|
||||||
|
{
|
||||||
int delta = 0;
|
int delta = 0;
|
||||||
int newx = -1;
|
int newx = -1;
|
||||||
int newy = -1;
|
int newy = -1;
|
||||||
|
|
||||||
if ( ( direction & POSITIVE ) == POSITIVE ) { delta = 1; }
|
if ((direction & POSITIVE) == POSITIVE)
|
||||||
else { delta = -1; }
|
{
|
||||||
|
delta = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delta = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ( direction & HORIZONTAL ) == HORIZONTAL ) { newx = x + delta; newy = y; }
|
if ((direction & HORIZONTAL) == HORIZONTAL)
|
||||||
else { newy = y + delta; newx = x; }
|
{
|
||||||
|
newx = x + delta;
|
||||||
|
newy = y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newy = y + delta;
|
||||||
|
newx = x;
|
||||||
|
}
|
||||||
|
|
||||||
if ( (newx >= 0) && ( newy >= 0 ) && (newx < width) && (newy < height) ) {
|
if ((newx >= 0) && (newy >= 0) && (newx < width) && (newy < height))
|
||||||
if( (t[newx][newy] ) == CLEAR){
|
{
|
||||||
|
if ((t[newx][newy]) == CLEAR)
|
||||||
|
{
|
||||||
freeDirection.add(new Short(direction));
|
freeDirection.add(new Short(direction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,7 +710,8 @@ implements WallsProvider
|
|||||||
Position last = openList.removeLast();
|
Position last = openList.removeLast();
|
||||||
if (last != current)
|
if (last != current)
|
||||||
{
|
{
|
||||||
// GUARD, should not happen ( or multi-thread access to model error )
|
// GUARD, should not happen ( or multi-thread access
|
||||||
|
// to model error )
|
||||||
System.err.println("INTERNAL ERROR 3");
|
System.err.println("INTERNAL ERROR 3");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -652,26 +721,50 @@ implements WallsProvider
|
|||||||
int newx = -1;
|
int newx = -1;
|
||||||
int newy = -1;
|
int newy = -1;
|
||||||
|
|
||||||
if ( ( direction & POSITIVE ) == POSITIVE ) { delta = 1; }
|
if ((direction & POSITIVE) == POSITIVE)
|
||||||
else { delta = -1; }
|
{
|
||||||
|
delta = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delta = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ( direction & HORIZONTAL ) == HORIZONTAL ) { newx = x + delta; newy = y; }
|
if ((direction & HORIZONTAL) == HORIZONTAL)
|
||||||
else { newy = y + delta; newx = x; }
|
{
|
||||||
|
newx = x + delta;
|
||||||
|
newy = y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newy = y + delta;
|
||||||
|
newx = x;
|
||||||
|
}
|
||||||
|
|
||||||
Position target = new Position(newx, newy, current.getDepth() + 1);
|
Position target = new Position(newx, newy, current.getDepth() + 1);
|
||||||
open(false, target);
|
open(false, target);
|
||||||
if (( t[x][y] & DIRECTION ) == DIRECTION ) { t[x][y] |= direction; }
|
if ((t[x][y] & DIRECTION) == DIRECTION)
|
||||||
else { t[x][y] = direction; } // not a 'direction' ... is it necessary to check ?
|
{
|
||||||
|
t[x][y] |= direction;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t[x][y] = direction;
|
||||||
|
} // not a 'direction' ... is it necessary to check ?
|
||||||
if (freeDirection.size() > 1)
|
if (freeDirection.size() > 1)
|
||||||
{
|
{
|
||||||
// keep it open at the very same place, previous open did add another node to inspect.
|
// keep it open at the very same place, previous open
|
||||||
|
// did add another node to inspect.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// else this was the unique direction , object already removed ( since if we try to remove it now it is not the last )
|
// else this was the unique direction , object already
|
||||||
|
// removed ( since if we try to remove it now it is not the
|
||||||
|
// last )
|
||||||
|
|
||||||
// can proceed to close
|
// can proceed to close
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// no free direction remaining => closing
|
// no free direction remaining => closing
|
||||||
Position last = openList.removeLast();
|
Position last = openList.removeLast();
|
||||||
if (last != current)
|
if (last != current)
|
||||||
@@ -707,7 +800,8 @@ implements WallsProvider
|
|||||||
return walls;
|
return walls;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** is there a wall in that direction ?
|
/**
|
||||||
|
* is there a wall in that direction ?
|
||||||
**/
|
**/
|
||||||
public boolean hasWallInDirection(int x, int y, short direction)
|
public boolean hasWallInDirection(int x, int y, short direction)
|
||||||
{
|
{
|
||||||
@@ -723,33 +817,43 @@ implements WallsProvider
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// is adjacent tile in direction pointing in reverse direction ? yes => no wall
|
// is adjacent tile in direction pointing in reverse direction ? yes =>
|
||||||
if ( ( direction & POSITIVE ) == POSITIVE ) { delta = 1; }
|
// no wall
|
||||||
else { delta = -1; }
|
if ((direction & POSITIVE) == POSITIVE)
|
||||||
|
{
|
||||||
|
delta = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delta = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ( direction & HORIZONTAL ) == HORIZONTAL ) {
|
if ((direction & HORIZONTAL) == HORIZONTAL)
|
||||||
|
{
|
||||||
newx = x + delta;
|
newx = x + delta;
|
||||||
newy = y;
|
newy = y;
|
||||||
reversedirection = (direction == RIGHT) ? LEFT : RIGHT;
|
reversedirection = (direction == RIGHT) ? LEFT : RIGHT;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
newy = y + delta;
|
newy = y + delta;
|
||||||
newx = x;
|
newx = x;
|
||||||
reversedirection = (direction == UP) ? DOWN : UP;
|
reversedirection = (direction == UP) ? DOWN : UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (newx >= 0) && ( newy >= 0 ) && (newx < width) && (newy < height) ) {
|
if ((newx >= 0) && (newy >= 0) && (newx < width) && (newy < height))
|
||||||
|
{
|
||||||
return ((t[newx][newy] & reversedirection) != reversedirection);
|
return ((t[newx][newy] & reversedirection) != reversedirection);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// outside boundaries.
|
// outside boundaries.
|
||||||
// TODO CHECK exits.
|
// TODO CHECK exits.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void streamOut( String pFormat, OutputStream pOut)
|
public void streamOut(String pFormat, OutputStream pOut) throws IOException
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
if ((pFormat == null) || (pFormat.equals("raw")))
|
if ((pFormat == null) || (pFormat.equals("raw")))
|
||||||
{
|
{
|
||||||
@@ -775,14 +879,12 @@ implements WallsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void streamIn( String pFormat, InputStream pIn)
|
private void streamIn(String pFormat, InputStream pIn) throws IOException
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
throw new IOException("Use correct constructor.");
|
throw new IOException("Use correct constructor.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseInputStream( String pFormat, InputStream pIn)
|
private void parseInputStream(String pFormat, InputStream pIn) throws IOException
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
if ((pFormat == null) || (pFormat.equals("raw")))
|
if ((pFormat == null) || (pFormat.equals("raw")))
|
||||||
{
|
{
|
||||||
@@ -805,7 +907,8 @@ implements WallsProvider
|
|||||||
t[x][y] = in.readShort();
|
t[x][y] = in.readShort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// should be at end of stream ? Not necessary can stream multiple labs ( or tiling ).
|
// should be at end of stream ? Not necessary can stream multiple
|
||||||
|
// labs ( or tiling ).
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.artisanlogiciel.games;
|
package org.artisanlogiciel.games;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
MazeCreationListener
|
* MazeCreationListener
|
||||||
**/
|
**/
|
||||||
interface MazeCreationListener
|
interface MazeCreationListener
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,21 +3,23 @@ package org.artisanlogiciel.games;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
MazeParams was autogenerated by ./generate_newclass.sh
|
* MazeParams was autogenerated by ./generate_newclass.sh
|
||||||
**/
|
**/
|
||||||
public interface MazeParams
|
public interface MazeParams
|
||||||
{
|
{
|
||||||
public int getWidth();
|
public int getWidth();
|
||||||
|
|
||||||
public int getHeight();
|
public int getHeight();
|
||||||
|
|
||||||
public int getMaxDepth();
|
public int getMaxDepth();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return name of Maze, used for creating filename at saving time
|
* @return name of Maze, used for creating filename at saving time
|
||||||
*/
|
*/
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return directory owning where to save a maze
|
* @return directory owning where to save a maze
|
||||||
*/
|
*/
|
||||||
public File getSaveDir();
|
public File getSaveDir();
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.artisanlogiciel.games;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
MazeResolutionListener used as interface between resolver and (mostly) GUI
|
* MazeResolutionListener used as interface between resolver and (mostly) GUI
|
||||||
**/
|
**/
|
||||||
public interface MazeResolutionListener
|
public interface MazeResolutionListener
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
package org.artisanlogiciel.games;
|
package org.artisanlogiciel.games;
|
||||||
|
|
||||||
public class Position {
|
public class Position
|
||||||
|
{
|
||||||
private int x, y;
|
private int x, y;
|
||||||
private int depth;
|
private int depth;
|
||||||
|
|
||||||
public Position(int x, int y,int depth){
|
public Position(int x, int y, int depth)
|
||||||
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Position(int x, int y){
|
public Position(int x, int y)
|
||||||
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.depth = 0;
|
this.depth = 0;
|
||||||
|
|||||||
@@ -1,220 +0,0 @@
|
|||||||
package org.artisanlogiciel.games;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wall3d to create walls in 3d
|
|
||||||
South, West North East...
|
|
||||||
**/
|
|
||||||
public class Wall3d
|
|
||||||
{
|
|
||||||
// 4 triangles in 2 dim space reused 3 times
|
|
||||||
final static int BASE[][][] = {{{0,0},{1,0},{0,1}},{{1,0},{1,1},{0,1}},{{0,0},{1,0},{1,1}},{{0,0},{1,1},{0,1}}};
|
|
||||||
|
|
||||||
final static short X=1;
|
|
||||||
final static short Y=2;
|
|
||||||
final static short Z=4;
|
|
||||||
|
|
||||||
// final static short AXIS[][]= {{X,Y},{-Z,Y},{X,Y},{Z,Y},{X,-Z},{X,-Z}};
|
|
||||||
final static short AXIS[][]= {{X,Y,0},{Z,Y,0},{X,Y,1},{Z,Y,1},{X,Z,0},{X,Z,1}};
|
|
||||||
|
|
||||||
public final static Wall3d South = new Wall3d(10,1,10,0,0,0);
|
|
||||||
public final static Wall3d West = new Wall3d(1,10,10,0,0,0);
|
|
||||||
public final static Wall3d North = new Wall3d(10,1,10,0,10,0);
|
|
||||||
public final static Wall3d East = new Wall3d(1,10,10,10,0,0);
|
|
||||||
|
|
||||||
int triangle[][][] = null;
|
|
||||||
|
|
||||||
public Wall3d(int t[][][])
|
|
||||||
{
|
|
||||||
triangle = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Wall3d(Wall3d origin, int dx, int dy, int dz)
|
|
||||||
{
|
|
||||||
triangle=origin.translate(dx,dy,dz);
|
|
||||||
}
|
|
||||||
|
|
||||||
Wall3d(int xl, int yl, int zl, int dx, int dy, int dz)
|
|
||||||
{
|
|
||||||
int f=0;
|
|
||||||
triangle = new int[12][3][3];
|
|
||||||
int[] factor = {xl,yl,zl};
|
|
||||||
int[] translate = {dx,dy,dz};
|
|
||||||
for (int i=0; i < 12; i++)
|
|
||||||
{
|
|
||||||
// point in a triangle
|
|
||||||
for (int p=0; p<3; p++)
|
|
||||||
{
|
|
||||||
short uaxis=0;
|
|
||||||
for (int axis=0; axis <2; axis++)
|
|
||||||
{
|
|
||||||
short caxis = AXIS[i/2][axis];
|
|
||||||
if ( caxis >0 )
|
|
||||||
{
|
|
||||||
f=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ( caxis <0 )
|
|
||||||
{
|
|
||||||
f=-1;
|
|
||||||
caxis=(short) -caxis;
|
|
||||||
}
|
|
||||||
uaxis|=caxis;
|
|
||||||
if ( caxis == X )
|
|
||||||
{
|
|
||||||
caxis=0;
|
|
||||||
}
|
|
||||||
else if ( caxis == Y)
|
|
||||||
{
|
|
||||||
caxis=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
caxis=2;
|
|
||||||
}
|
|
||||||
// if ( f == 0 )
|
|
||||||
// {
|
|
||||||
// System.out.println("ERROR");
|
|
||||||
// }
|
|
||||||
//System.out.println("i " + i + " p " + p + " a " + caxis + " , " + BASE[i%4][p][axis] );
|
|
||||||
triangle[i][p][caxis]=translate[caxis] + BASE[i%4][p][axis]*f*factor[caxis];
|
|
||||||
}
|
|
||||||
if ( (uaxis & X) == 0 )
|
|
||||||
{
|
|
||||||
uaxis=0;
|
|
||||||
}
|
|
||||||
else if ( (uaxis & Y) == 0)
|
|
||||||
{
|
|
||||||
uaxis=1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uaxis=2;
|
|
||||||
}
|
|
||||||
triangle[i][p][uaxis]=translate[uaxis] + AXIS[i/2][2]*factor[uaxis];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int[][][] translate(int dx, int dy, int dz)
|
|
||||||
{
|
|
||||||
int[] translate = {dx,dy,dz};
|
|
||||||
int t[][][] = new int[12][3][3];
|
|
||||||
|
|
||||||
for (int i=0; i < 12; i++)
|
|
||||||
{
|
|
||||||
// point in a triangle
|
|
||||||
for (int p=0; p<3; p++)
|
|
||||||
{
|
|
||||||
for (int axis=0; axis <3; axis++)
|
|
||||||
{
|
|
||||||
t[i][p][axis]=translate[axis] + triangle[i][p][axis];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
String s = "";
|
|
||||||
for (int t=0; t<12; t++)
|
|
||||||
{
|
|
||||||
s+="facet normal 0 0 0\nouter loop\n";
|
|
||||||
for (int p=0; p<3; p++)
|
|
||||||
{
|
|
||||||
s+="vertex";
|
|
||||||
for (int a=0; a<3; a++)
|
|
||||||
{
|
|
||||||
// s+=" t "+ t + " p " + p + " a " + a + "=" + triangle[t][p][a];
|
|
||||||
s+= " " + triangle[t][p][a];
|
|
||||||
}
|
|
||||||
s+="\n";
|
|
||||||
}
|
|
||||||
s=s+"endloop\nendfacet\n";
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void prepare()
|
|
||||||
{
|
|
||||||
System.out.println(South.toString());
|
|
||||||
System.out.println(East.toString());
|
|
||||||
System.out.println(North.toString());
|
|
||||||
System.out.println(West.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void streamWallsOut(String name, WallsProvider provider, OutputStream stream)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
int width = provider.getWidth();
|
|
||||||
int height = provider.getHeight();
|
|
||||||
int xl = 10;
|
|
||||||
int yl = 10;
|
|
||||||
int zl = 10;
|
|
||||||
|
|
||||||
// WARNING DOWN - UP reversed ( in 2D Y is oriented to lower, in 3D it is to upper ).
|
|
||||||
stream.write(("solid " + name + "\n").getBytes());
|
|
||||||
for (int x=0; x<width; x++)
|
|
||||||
{
|
|
||||||
short walls = provider.getWalls(x,0);
|
|
||||||
if ( (walls & Brick.UP) != 0 )
|
|
||||||
{
|
|
||||||
stream.write(new Wall3d(South,x*xl,0,0).toString().getBytes());
|
|
||||||
}
|
|
||||||
if ( (walls & Brick.LEFT) != 0 )
|
|
||||||
{
|
|
||||||
stream.write(new Wall3d(West,x*xl,0,0).toString().getBytes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int y=0; y<height; y++)
|
|
||||||
{
|
|
||||||
short walls = provider.getWalls(0,y);
|
|
||||||
if ( (walls & Brick.LEFT) != 0 )
|
|
||||||
{
|
|
||||||
stream.write(new Wall3d(West,0,y*yl,0).toString().getBytes());
|
|
||||||
}
|
|
||||||
for (int x=0; x<width; x++)
|
|
||||||
{
|
|
||||||
// south and east
|
|
||||||
walls = provider.getWalls(x,y);
|
|
||||||
if ( (walls & Brick.DOWN) != 0 )
|
|
||||||
{
|
|
||||||
stream.write(new Wall3d(North,x*xl,y*yl,0).toString().getBytes());
|
|
||||||
}
|
|
||||||
if ( (walls & Brick.RIGHT) != 0)
|
|
||||||
{
|
|
||||||
stream.write(new Wall3d(East,x*xl,y*yl,0).toString().getBytes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.write("endsolid wall\n\n".getBytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String args[]) {
|
|
||||||
|
|
||||||
Scanner console = new Scanner(System.in);
|
|
||||||
int xl = console.nextInt();
|
|
||||||
int yl = console.nextInt();
|
|
||||||
int zl = console.nextInt();
|
|
||||||
|
|
||||||
int dx = console.nextInt();
|
|
||||||
int dy = console.nextInt();
|
|
||||||
int dz = console.nextInt();
|
|
||||||
|
|
||||||
String s="solid wall\n";
|
|
||||||
|
|
||||||
Wall3d instance=new Wall3d(xl,yl,zl, dx,dy,dz);
|
|
||||||
|
|
||||||
prepare();
|
|
||||||
|
|
||||||
s+="endsolid wall\n\n";
|
|
||||||
System.out.println(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.artisanlogiciel.games;
|
package org.artisanlogiciel.games;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
WallsProvider provide a Walls representation
|
* WallsProvider provide a Walls representation
|
||||||
**/
|
**/
|
||||||
public interface WallsProvider
|
public interface WallsProvider
|
||||||
{
|
{
|
||||||
@@ -11,17 +11,10 @@ public interface WallsProvider
|
|||||||
int getHeight();
|
int getHeight();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
See Brick
|
* See Brick
|
||||||
|
*
|
||||||
Will set bits :
|
* Will set bits : 3 2 1 0 (8)(4)(2)(1) ^ > v < U R D L p i o e g w f h n t
|
||||||
3 2 1 0
|
* t
|
||||||
(8)(4)(2)(1)
|
|
||||||
^ > v <
|
|
||||||
U R D L
|
|
||||||
p i o e
|
|
||||||
g w f
|
|
||||||
h n t
|
|
||||||
t
|
|
||||||
**/
|
**/
|
||||||
public short getWalls(int x, int y);
|
public short getWalls(int x, int y);
|
||||||
}
|
}
|
||||||
|
|||||||
225
java/org/artisanlogiciel/games/stl/Wall3d.java
Normal file
225
java/org/artisanlogiciel/games/stl/Wall3d.java
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
package org.artisanlogiciel.games.stl;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.artisanlogiciel.games.Brick;
|
||||||
|
import org.artisanlogiciel.games.WallsProvider;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wall3d to create walls in 3d for stl conversion South, West North East...
|
||||||
|
**/
|
||||||
|
public class Wall3d
|
||||||
|
{
|
||||||
|
// 4 triangles in 2 dim space reused 3 times
|
||||||
|
final static int BASE[][][] = { { { 0, 0 }, { 1, 0 }, { 0, 1 } }, { { 1, 0 }, { 1, 1 }, { 0, 1 } },
|
||||||
|
{ { 0, 0 }, { 1, 0 }, { 1, 1 } }, { { 0, 0 }, { 1, 1 }, { 0, 1 } } };
|
||||||
|
|
||||||
|
final static short X = 1;
|
||||||
|
final static short Y = 2;
|
||||||
|
final static short Z = 4;
|
||||||
|
|
||||||
|
// final static short AXIS[][]= {{X,Y},{-Z,Y},{X,Y},{Z,Y},{X,-Z},{X,-Z}};
|
||||||
|
final static short AXIS[][] = { { X, Y, 0 }, { Z, Y, 0 }, { X, Y, 1 }, { Z, Y, 1 }, { X, Z, 0 }, { X, Z, 1 } };
|
||||||
|
|
||||||
|
public final static Wall3d South = new Wall3d(10, 1, 10, 0, 0, 0);
|
||||||
|
public final static Wall3d West = new Wall3d(1, 10, 10, 0, 0, 0);
|
||||||
|
public final static Wall3d North = new Wall3d(10, 1, 10, 0, 10, 0);
|
||||||
|
public final static Wall3d East = new Wall3d(1, 10, 10, 10, 0, 0);
|
||||||
|
|
||||||
|
int triangle[][][] = null;
|
||||||
|
|
||||||
|
public Wall3d(int t[][][])
|
||||||
|
{
|
||||||
|
triangle = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wall3d(Wall3d origin, int dx, int dy, int dz)
|
||||||
|
{
|
||||||
|
triangle = origin.translate(dx, dy, dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wall3d(int xl, int yl, int zl, int dx, int dy, int dz)
|
||||||
|
{
|
||||||
|
int f = 0;
|
||||||
|
triangle = new int[12][3][3];
|
||||||
|
int[] factor = { xl, yl, zl };
|
||||||
|
int[] translate = { dx, dy, dz };
|
||||||
|
for (int i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
// point in a triangle
|
||||||
|
for (int p = 0; p < 3; p++)
|
||||||
|
{
|
||||||
|
short uaxis = 0;
|
||||||
|
for (int axis = 0; axis < 2; axis++)
|
||||||
|
{
|
||||||
|
short caxis = AXIS[i / 2][axis];
|
||||||
|
if (caxis > 0)
|
||||||
|
{
|
||||||
|
f = 1;
|
||||||
|
}
|
||||||
|
else if (caxis < 0)
|
||||||
|
{
|
||||||
|
f = -1;
|
||||||
|
caxis = (short) -caxis;
|
||||||
|
}
|
||||||
|
uaxis |= caxis;
|
||||||
|
if (caxis == X)
|
||||||
|
{
|
||||||
|
caxis = 0;
|
||||||
|
}
|
||||||
|
else if (caxis == Y)
|
||||||
|
{
|
||||||
|
caxis = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caxis = 2;
|
||||||
|
}
|
||||||
|
// if ( f == 0 )
|
||||||
|
// {
|
||||||
|
// System.out.println("ERROR");
|
||||||
|
// }
|
||||||
|
// System.out.println("i " + i + " p " + p + " a " + caxis +
|
||||||
|
// " , " + BASE[i%4][p][axis] );
|
||||||
|
triangle[i][p][caxis] = translate[caxis] + BASE[i % 4][p][axis] * f * factor[caxis];
|
||||||
|
}
|
||||||
|
if ((uaxis & X) == 0)
|
||||||
|
{
|
||||||
|
uaxis = 0;
|
||||||
|
}
|
||||||
|
else if ((uaxis & Y) == 0)
|
||||||
|
{
|
||||||
|
uaxis = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uaxis = 2;
|
||||||
|
}
|
||||||
|
triangle[i][p][uaxis] = translate[uaxis] + AXIS[i / 2][2] * factor[uaxis];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][][] translate(int dx, int dy, int dz)
|
||||||
|
{
|
||||||
|
int[] translate = { dx, dy, dz };
|
||||||
|
int t[][][] = new int[12][3][3];
|
||||||
|
|
||||||
|
for (int i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
// point in a triangle
|
||||||
|
for (int p = 0; p < 3; p++)
|
||||||
|
{
|
||||||
|
for (int axis = 0; axis < 3; axis++)
|
||||||
|
{
|
||||||
|
t[i][p][axis] = translate[axis] + triangle[i][p][axis];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
String s = "";
|
||||||
|
for (int t = 0; t < 12; t++)
|
||||||
|
{
|
||||||
|
s += "facet normal 0 0 0\nouter loop\n";
|
||||||
|
for (int p = 0; p < 3; p++)
|
||||||
|
{
|
||||||
|
s += "vertex";
|
||||||
|
for (int a = 0; a < 3; a++)
|
||||||
|
{
|
||||||
|
// s+=" t "+ t + " p " + p + " a " + a + "=" +
|
||||||
|
// triangle[t][p][a];
|
||||||
|
s += " " + triangle[t][p][a];
|
||||||
|
}
|
||||||
|
s += "\n";
|
||||||
|
}
|
||||||
|
s = s + "endloop\nendfacet\n";
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void prepare()
|
||||||
|
{
|
||||||
|
System.out.println(South.toString());
|
||||||
|
System.out.println(East.toString());
|
||||||
|
System.out.println(North.toString());
|
||||||
|
System.out.println(West.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void streamWallsOut(String name, WallsProvider provider, OutputStream stream) throws IOException
|
||||||
|
{
|
||||||
|
int width = provider.getWidth();
|
||||||
|
int height = provider.getHeight();
|
||||||
|
int xl = 10;
|
||||||
|
int yl = 10;
|
||||||
|
int zl = 10;
|
||||||
|
|
||||||
|
// WARNING DOWN - UP reversed ( in 2D Y is oriented to lower, in 3D it
|
||||||
|
// is to upper ).
|
||||||
|
stream.write(("solid " + name + "\n").getBytes());
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
short walls = provider.getWalls(x, 0);
|
||||||
|
if ((walls & Brick.UP) != 0)
|
||||||
|
{
|
||||||
|
stream.write(new Wall3d(South, x * xl, 0, 0).toString().getBytes());
|
||||||
|
}
|
||||||
|
if ((walls & Brick.LEFT) != 0)
|
||||||
|
{
|
||||||
|
stream.write(new Wall3d(West, x * xl, 0, 0).toString().getBytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
short walls = provider.getWalls(0, y);
|
||||||
|
if ((walls & Brick.LEFT) != 0)
|
||||||
|
{
|
||||||
|
stream.write(new Wall3d(West, 0, y * yl, 0).toString().getBytes());
|
||||||
|
}
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
// south and east
|
||||||
|
walls = provider.getWalls(x, y);
|
||||||
|
if ((walls & Brick.DOWN) != 0)
|
||||||
|
{
|
||||||
|
stream.write(new Wall3d(North, x * xl, y * yl, 0).toString().getBytes());
|
||||||
|
}
|
||||||
|
if ((walls & Brick.RIGHT) != 0)
|
||||||
|
{
|
||||||
|
stream.write(new Wall3d(East, x * xl, y * yl, 0).toString().getBytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream.write("endsolid wall\n\n".getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String args[])
|
||||||
|
{
|
||||||
|
|
||||||
|
Scanner console = new Scanner(System.in);
|
||||||
|
int xl = console.nextInt();
|
||||||
|
int yl = console.nextInt();
|
||||||
|
int zl = console.nextInt();
|
||||||
|
|
||||||
|
int dx = console.nextInt();
|
||||||
|
int dy = console.nextInt();
|
||||||
|
int dz = console.nextInt();
|
||||||
|
|
||||||
|
String s = "solid wall\n";
|
||||||
|
|
||||||
|
Wall3d instance = new Wall3d(xl, yl, zl, dx, dy, dz);
|
||||||
|
|
||||||
|
prepare();
|
||||||
|
|
||||||
|
s += "endsolid wall\n\n";
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
lab/lab100x100.raw
Normal file
BIN
lab/lab100x100.raw
Normal file
Binary file not shown.
858903
lab/lab100x100.stl
Normal file
858903
lab/lab100x100.stl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab12x35.raw
Normal file
BIN
lab/lab12x35.raw
Normal file
Binary file not shown.
39567
lab/lab12x35.stl
Normal file
39567
lab/lab12x35.stl
Normal file
File diff suppressed because it is too large
Load Diff
16963
lab/lab20x20.gcode
Normal file
16963
lab/lab20x20.gcode
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab20x20.raw
Normal file
BIN
lab/lab20x20.raw
Normal file
Binary file not shown.
37467
lab/lab20x20.stl
Normal file
37467
lab/lab20x20.stl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab30x30.raw
Normal file
BIN
lab/lab30x30.raw
Normal file
Binary file not shown.
81399
lab/lab30x30.stl
Normal file
81399
lab/lab30x30.stl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab40x40.raw
Normal file
BIN
lab/lab40x40.raw
Normal file
Binary file not shown.
141879
lab/lab40x40.stl
Normal file
141879
lab/lab40x40.stl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab50x50.raw
Normal file
BIN
lab/lab50x50.raw
Normal file
Binary file not shown.
219663
lab/lab50x50.stl
Normal file
219663
lab/lab50x50.stl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab60x36.raw
Normal file
BIN
lab/lab60x36.raw
Normal file
Binary file not shown.
190767
lab/lab60x36.stl
Normal file
190767
lab/lab60x36.stl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lab/lab98x98.raw
Normal file
BIN
lab/lab98x98.raw
Normal file
Binary file not shown.
825135
lab/lab98x98.stl
Normal file
825135
lab/lab98x98.stl
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user