Ich kriege hier immer einen Bad Exe Error beim Erstellen einer Hand.#10
Open
ChrisBtt wants to merge 3 commits intoiOS-Dev-Kurs:masterfrom
Open
Ich kriege hier immer einen Bad Exe Error beim Erstellen einer Hand.#10ChrisBtt wants to merge 3 commits intoiOS-Dev-Kurs:masterfrom
ChrisBtt wants to merge 3 commits intoiOS-Dev-Kurs:masterfrom
Conversation
… du mir sagen, woran das liegt?
04 - Poker.playground/Contents.swift
Outdated
| import UIKit | ||
|
|
||
| enum Ranks: Int, CustomStringConvertible { | ||
| case Ass = 1, König, Dame, Bube, Zehn, Neun, Acht, Sieben, Sechs, Fünf, Vier, Drei, Zwei |
Member
There was a problem hiding this comment.
Entferne einfach das = 1 hier und...
Author
|
Relativ weit unten bei |
04 - Poker.playground/Contents.swift
Outdated
| while cards.count < 5 { | ||
| print("\(cards.count)") | ||
| let newCard = Card.createCard() | ||
| if newCard != cards[cards.count] { |
Member
There was a problem hiding this comment.
cards[cards.count] ist immer eine Laufzeitfehler, denn die Indizes eines Arrays sind 0..<count, d.h. maximal count-1.
Das append vor dem while brauchst du gar nicht, denke ich. Aber im while solltest du nicht nur die letzte Karte prüfen (das wäre cards[cards.count - 1]) sondern alle bereits erstellten, also z.B. mit cards.contains(newCard).
| print("\(cards.count)") | ||
| let newCard = Card.createCard() | ||
| if cards.contains(newCard) { | ||
| break |
Member
There was a problem hiding this comment.
break verlässt die while-Schleife, du brauchst hier continue.
Member
|
2/3 Pt. erstmal, kannst du aber auch noch fertig schreiben. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kannst du mir sagen, woran das liegt?
Ich versuche das jetzt fast seit zwei Wochen und falle bald vom Glauben ab.
Bis zur Funktion die Karten zu vergleichen bin ich erst gar nicht gekommen.