Last active
June 8, 2017 11:16
-
-
Save veeara282/b09d0f884e0e62ad091f53cb3d2d6d31 to your computer and use it in GitHub Desktop.
Mockup of an inclusive version of Attract
This file contains 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
enum Gender {MALE, FEMALE, GENDERLESS} |
This file contains 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
class Pokemon { | |
Gender gender; | |
Sexuality sexuality; | |
/** | |
* Attempts to infatuate the {@code opponent} Pokemon, returning {@literal true} if the move could succeed | |
* or {@literal false} if the move will fail. | |
*/ | |
boolean attract(Pokemon opponent) { | |
switch (opponent.sexuality) { | |
// Opponent isn't attracted to Pokemon of any gender | |
case Sexuality.ASEXUAL: | |
return false; | |
// Opponent can be attracted by Pokemon of any gender | |
case Sexuality.PANSEXUAL: | |
return true; | |
// Opponent can only be attracted by Pokemon of the same gender | |
case Sexuality.HOMOSEXUAL: | |
return gender == opponent.gender; | |
// Opponent can only be attracted by Pokemon of a different gender | |
case Sexuality.HETEROSEXUAL: | |
return gender != opponent.gender; | |
} | |
} | |
} |
This file contains 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
enum Sexuality {HETEROSEXUAL, HOMOSEXUAL, PANSEXUAL, ASEXUAL}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MIT License
Copyright © 2017 Aidan Fitzgerald
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Software or the use of or other dealings in the Software.