Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Question

Commonmark migration
Source Link

Backstory

#Backstory YouYou wake up dizzy in a chemistry laboratory, and you realize you have been kidnapped by a old mad chemist. Since he cannot see very well because of his age, he wants you to work for him and only then, you can escape the laboratory.

#Backstory You wake up dizzy in a chemistry laboratory, and you realize you have been kidnapped by a old mad chemist. Since he cannot see very well because of his age, he wants you to work for him and only then, you can escape the laboratory.

Backstory

You wake up dizzy in a chemistry laboratory, and you realize you have been kidnapped by a old mad chemist. Since he cannot see very well because of his age, he wants you to work for him and only then, you can escape the laboratory.

Notice removed Draw attention by user68509
Bounty Ended with Level River St's answer chosen by Community Bot
added 153 characters in body
Source Link
user68509
user68509

You do not need to output the labels of the formulae and you can output either of the rotations when two exist. For example you can output either 02 or 35.

You do not need to output the labels of the formulae and you can output either of the rotations when two exist. For example you can output either 02 or 35.

added 1873 characters in body
Source Link
user68509
user68509

The output display must not handle redundancies like π/n rotation of the whole molecule (n a natural integer).

A rotation by 180 degrees in the plane of the page of one of the molecule's formula is considered a redundancy and does not need to be displayed.

In the example below I'll show all of the possible formulae for a molecule, then point out the ones that do not need to be displayed.

Input: C2H6O2
Output: (no need to print the frame

First, ALLhere are all the possible molecules are displayed belowformulae for this input (Thank you to @Jonathan Allan)

+----------------+ +-------------------+ +---------------+
|01 H H | | H |
 O | | H
 H | |
| H - O |- C - |C - H
 | | | |
 |H | H
 
02 | | H
| O O | | O H O
 | | | O |
 H - O - |
|C - C - H
 | | | | |
 | | H H
 
03 | | | H | H
 |
| H - C - C -| H | | H - O - C - C - O - H | | H - C - C - H |
| |
 | | H | | H
 
04 | | H H
 | | | | H - O |
|- C - C - H H | | |
 H H H |O
 | H O |
|  H
 |
05 | H H
 | | |
 H - O |- C - C - |H
| | |
 | | O H
 | | H |
+----------------+ +-------------------+ +---------------+
12 
+----------------+ +-------------------+ 
| H H
 H | | |
 O O
 | 
| | | | |H - C - C - H
 | |
|  H O H |H
 |
13 H H | | | | O H
 | | | | |
 | 
| H - C - C - O - H | | H - C - C - O| - H |
| | | H H
 |
14 | | H
 | |
| O H | | |
 O H - C - C - H
 | 
| | |
 | | H |O
 | | H H
 | |
15 H H
 |
+----------------+ +-------------------+ 
+-----------------------+ 
| O H
 | |
|  H - C - C - H
 | | H O H | | | H
 
23 | |
| H - O - C - C - O - H | 
| |
 | |H O
 | 
| | |
 H H - C - C - O - H
 | 
| | |
 H | H
| 
24 H
 | 
+-----------------------+ 
+--------------------+ +---------------+ +-------------------+
| H O
  | | H - C - C - H
 | | | H |
 |
| H O
 | | | | H
 |
25 | | H
 |
| |
 O H H | | O
 O H | | | H H O- C - C - H
 |
| | | | | |O H
 | | | | | | H
 
34 |
| H - O -H
 C - C - H | | H -| C - C|
 - H | | H - C - C - O - H |
| | | | | H | O
 | | | | | | H
| 
35 H H | | | O |
 H H |- |C - C - O - H H | |
| O H
 | | | H
 
45 | | H H
 | |
| H - C - C - H
 | | H O O
 | | | |
 |
+--------------------+ +---------------+ +-------------------+H  H

Keep in mindAnd here are the formulae that π rotationshould be in the output if we take out the rotations of 180° in the whole melucule is a redundancy.plane of the page :

01 H
 |
 O H
 | |
 H - O - C - C - H
 | |
 H H
 
 
03 H H
 | |
 H - O - C - C - O - H
 | |
 H H
 
12 H H
 | |
 O O
 | |
 H - C - C - H
 | |
 H H
 
13 H
 |
 O H
 | |
 H - C - C - O - H
 | |
 H H
 
14 H
 |
 O H
 | |
 H - C - C - H
 | |
 H O
 |
 H
 
 
 15 H
 |
 O H 
 | |
 H - C - C - H
 | |
 O H
 |
 H 
23 H
 |
 H O
 | |
 H - C - C - O - H
 | |
 H H
 
 
25 H
 |
 H O
 | |
 H - C - C - H
 | |
 O H
 |
 H
 
 
35 H H
 | |
 H - C - C - O - H
 | |
 O H
 |
 H

The output display must not handle redundancies like π/n rotation of the whole molecule (n a natural integer).

Input: C2H6O2
Output: (no need to print the frame, ALL the possible molecules are displayed below)

+----------------+ +-------------------+ +---------------+
| H H | | H | | H |
| | | | | | | | | |
| O O | | O H | | O H |
| | | | | | | | | | | |
| H - C - C - H | | H - C - C - O - H | | H - C - C - H |
| | | | | | | | | | | |
| H H | | H H | | H O |
|  | | | | | |
| | | | | H |
+----------------+ +-------------------+ +---------------+ 
+----------------+ +-------------------+ 
| H | | | 
| | | | |
|  H O | | H H | | | | | | | | | 
| H - C - C - H | | H - C - C - O - H |
| | | | | | | |
| O H | | O H | 
| | | | | | | H | | H |
+----------------+ +-------------------+ 
+-----------------------+ 
| |
|  | | H H | | | | |
| H - O - C - C - O - H | 
| | | | 
| H H | 
| | 
| | 
+-----------------------+ 
+--------------------+ +---------------+ +-------------------+
| H | | H | | H  |
| | | | | | | | |
| O H | | O H | | H O |
| | | | | | | | | | | |
| H - O - C - C - H | | H - C - C - H | | H - C - C - O - H |
| | | | | | | | | | | |
| H H | | O H | | H H |
| | | | | | |
| | | H | | |
+--------------------+ +---------------+ +-------------------+ 

Keep in mind that π rotation of the whole melucule is a redundancy.

A rotation by 180 degrees in the plane of the page of one of the molecule's formula is considered a redundancy and does not need to be displayed.

In the example below I'll show all of the possible formulae for a molecule, then point out the ones that do not need to be displayed.

Input: C2H6O2

First, here are all the possible formulae for this input (Thank you to @Jonathan Allan)

01 H |
 O H
 | |
 H - O - C - C - H
 | |
 H H
 
02  H
 | H O
 | |
 H - O - C - C - H
 | |
 H H
 
03 H H
 | | H - O - C - C - O - H | |
 H H
 
04 H H
 | | H - O - C - C - H | |
 H O
 |
 H
 
05 H H
 | |
 H - O - C - C - H
 | |
 O H
 | H
 
12 H H
 | |
 O O
 | | H - C - C - H
 | |
 H H
 
13 H | O H
 | |
 H - C - C - O - H | |
 H H
 
14 H
 |
 O H | |
 H - C - C - H
 | |
 H O
 | H
 
15 H
 |
 O H
 | |
 H - C - C - H
 | |  O H | H
 
23 H |
 H O
 | |
 H - C - C - O - H
 | |
 H H
 
24 H
 | H O
  | | H - C - C - H
 | |
 H O
 | H
 
25 H
 |
 H O
 | | H - C - C - H
 | | O H
 | H
 
34 H H
 | |
 H - C - C - O - H
 | | H  O
 |  H
 
35 H H | |
 H - C - C - O - H | |
 O H
 | H
 
45 H H
 | |
 H - C - C - H
 | | O O
 | |
 H  H

And here are the formulae that should be in the output if we take out the rotations of 180° in the plane of the page :

01 H
 |
 O H
 | |
 H - O - C - C - H
 | |
 H H
 
 
03 H H
 | |
 H - O - C - C - O - H
 | |
 H H
 
12 H H
 | |
 O O
 | |
 H - C - C - H
 | |
 H H
 
13 H
 |
 O H
 | |
 H - C - C - O - H
 | |
 H H
 
14 H
 |
 O H
 | |
 H - C - C - H
 | |
 H O
 |
 H
 
 
 15 H
 |
 O H 
 | |
 H - C - C - H
 | |
 O H
 |
 H 
23 H
 |
 H O
 | |
 H - C - C - O - H
 | |
 H H
 
 
25 H
 |
 H O
 | |
 H - C - C - H
 | |
 O H
 |
 H
 
 
35 H H
 | |
 H - C - C - O - H
 | |
 O H
 |
 H
added 44 characters in body
Source Link
user68509
user68509
Loading
deleted 486 characters in body
Source Link
user68509
user68509
Loading
added 797 characters in body
Source Link
user68509
user68509
Loading
Notice added Draw attention by user68509
Bounty Started worth 50 reputation by Community Bot
Tweeted twitter.com/StackCodeGolf/status/858125492280578048
Post Reopened by Community Bot, Toto, Timtech, Wheat Wizard
deleted 4 characters in body
Source Link
user68509
user68509
Loading
Added the complete example and the rules needed to have complete specifications for the challenge
Source Link
user68509
user68509
Loading
Post Closed as "Needs details or clarity" by Community Bot, Laikoni, Jonathan Allan, Toto
added 56 characters in body
Source Link
user68509
user68509
Loading
deleted 1 character in body
Source Link
mbomb007
  • 23.6k
  • 7
  • 66
  • 143
Loading
Added clarification and grouped statements. Hope this will make the post clearer...
Source Link
Luke
  • 4.9k
  • 17
  • 23
Loading
added 652 characters in body
Source Link
user68509
user68509
Loading
More generic language concerning bonds, since H-C≡C-H should also be ruled out.
Source Link
mbomb007
  • 23.6k
  • 7
  • 66
  • 143
Loading
edited body
Source Link
user68509
user68509
Loading
deleted 270 characters in body
Source Link
user68509
user68509
Loading
Source Link
user68509
user68509
Loading

AltStyle によって変換されたページ (->オリジナル) /