bwinf:bwinf40a1:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
bwinf:bwinf40a1:start [2023/06/19 06:27] – angelegt Martin Pabst | bwinf:bwinf40a1:start [2023/06/19 07:44] (aktuell) – Martin Pabst | ||
---|---|---|---|
Zeile 8: | Zeile 8: | ||
<script type=" | <script type=" | ||
- | Data data = new Data(); | + | Data data = new Data("parkplatz0.txt" |
- | data.readFromFile("parkplatz1.txt" | + | |
</ | </ | ||
<script type=" | <script type=" | ||
+ | class Data { | ||
+ | char firstVerticalCarCharacter; | ||
+ | char lastVerticalCarCharacter; | ||
+ | int numberOfVerticalCars; | ||
+ | int numberOfHorizontalCars; | ||
+ | |||
+ | int[] horizontalCarPositions; | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | String[] lines = Files.read(filename).split(" | ||
+ | |||
+ | firstVerticalCarCharacter = lines[0].split(" | ||
+ | lastVerticalCarCharacter = lines[0].split(" | ||
+ | |||
+ | numberOfVerticalCars = alphabet.indexOf(lastVerticalCarCharacter) + 1; | ||
+ | |||
+ | numberOfHorizontalCars = Integer.parseInt(lines[1].trim()); | ||
+ | |||
+ | horizontalCarPositions = new int[numberOfHorizontalCars]; | ||
+ | horizontalCarNames = new char[numberOfHorizontalCars]; | ||
+ | |||
+ | for (int i = 0; i < numberOfHorizontalCars; | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
</ | </ | ||
- | <script type=" | + | <script type=" |
+ | A G | ||
+ | 2 | ||
+ | H 2 | ||
+ | I 5 | ||
</ | </ | ||
- | <script type=" | + | <script type=" |
+ | A N | ||
+ | 4 | ||
+ | O 1 | ||
+ | P 3 | ||
+ | Q 6 | ||
+ | R 10 | ||
</ | </ | ||
- | <script type=" | + | <script type=" |
+ | A N | ||
+ | 5 | ||
+ | O 2 | ||
+ | P 5 | ||
+ | Q 7 | ||
+ | R 9 | ||
+ | S 12 | ||
</ | </ | ||
- | <script type=" | + | <script type=" |
+ | A N | ||
+ | 5 | ||
+ | O 1 | ||
+ | P 4 | ||
+ | Q 8 | ||
+ | R 10 | ||
+ | S 12 | ||
</ | </ | ||
- | <script type=" | + | <script type=" |
+ | A P | ||
+ | 5 | ||
+ | Q 0 | ||
+ | R 2 | ||
+ | S 6 | ||
+ | T 10 | ||
+ | U 13 | ||
</ | </ | ||
- | <script type=" | + | <script type=" |
+ | A O | ||
+ | 4 | ||
+ | P 2 | ||
+ | Q 4 | ||
+ | R 8 | ||
+ | S 12 | ||
</ | </ | ||
<script type=" | <script type=" | ||
+ | Jede Datei beschreibt einen Schiebeparkplatz und enthält | ||
+ | |||
+ | * in der ersten Zeile die Bezeichnung des ersten und letzten Autos | ||
+ | auf den normalen Parkplätzen (Bezeichnungen „A“, „B“, „C“, usw.), | ||
+ | * in der zweiten Zeile die Anzahl n der quer stehenden Autos und | ||
+ | * in den weiteren n Zeilen für jedes quer stehende Auto jeweils. | ||
+ | * die Bezeichnung des quer stehenden Autos und | ||
+ | * die Position p_i des quer stehenden Autos. | ||
+ | |||
+ | Die Position startet links von 0. Jedes verschiebbare Auto nimmt wie in | ||
+ | der Zeichnung gezeigt zwei Positionen ein (also jeweils p_i und p_i + 1). | ||
</ | </ | ||
</ | </ | ||
</ | </ |
bwinf/bwinf40a1/start.1687156028.txt.gz · Zuletzt geändert: 2023/06/19 06:27 von Martin Pabst