Aslam CADER - #13
Open
AAA97AAA wants to merge 12 commits into
Open
Conversation
…ire State et battle
…linitialisation des elements necessaires aux differents rounds"
J'ai crée une fonction random_number qui me calcule un nombre aléatoire (fonctionnement sous Linux également), grâce au code:
#if os(Linux)
return Int(random() % (max + 1))
#else
return Int(arc4random_uniform(UInt32(max)))
#endif
qui est une solution trouvé sur le site: https://bugs.swift.org/browse/SR-685
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.
La validation ne fonctionne pas car j'ai utilisé la fonction arc4random qui n'est pas défini sur Linux.
Mais j'ai compilé (sous Sierra) et il semble fonctionner sans problème!
Dans la fonction damage, je n'avais pas compris l'utilisation de l'environnement, car d'après ma question que je vous avait posé, il suffisait d'utiliser TypeModifier pour calculer le Modifier au lieu de faire tout leur calcul (avec tout les éléments STAB, ... (page damage sur bulbapedia))
C'est pourquoi, dans la Struct State, j'ai voulu ajouté l'environnement (que je n'avais pas utilisé): avec des index random sur un range précis, on aurait pu générer un environnement aléatoire.
Mais je ne l'ai pas faite, car cela aurait impliqué que je complète la fonction damage et modifié deux trois partis du code, et je me suis pris trop tard pour finir ce TP, donc je n'ai pas pu faire ça. (Au début, je pensais que ce n'était pas nécessaire comme je l'ai expliqué plus haut).
Merci,
Aslam