‘Easter eggs’ zijn een bekend begrip binnen softwareland. De meeste klanten waarderen het niet als je easter eggs in hun productiecode zet, dus hier is je moment! Pak je Java verfpot en je toetsenbord en maak, letterlijk, het allertofste paasei. Gebruik ons template en versier het ei op de meest creatieve manier. Misschien kan je hem zelfs animeren als een flipbook?
Het paasei leveren wij, de invulling is aan jou. Wel zijn er enkele regels om rekening mee te houden:
- Het paasei moet geprint zijn in je console.
- Het is niet de bedoeling dat het paasei blokje in een println() wordt gemaakt, om deze vervolgens uit te printen. Daarom jureren we alleen paaseieren die genereerd worden op basis van code algoritme. Bijvoorbeeld wat niet is toegestaan:
public void drawEgg() {
println(" _ ");
println(" _(\")_ ");
println("(_ . _)");
println(" / : \\ ");
println("(_/ \\_)");
}
- De code is geschreven in Java
- De code is te vinden op GitHub en Fork de repo van https://github.com/SogetiEasterEgg/SogetiEasterEggChallenge2021
- Deze Fork wordt vóór 29-03-2021 gedeeld met [email protected]
if (isaLeftEyeBrow(yCoordinate, xCoordinate)) {
System.out.print(Colors.BLACK.getColor());
}
else if (isaRightEyeBrow(yCoordinate, xCoordinate)) {
System.out.print(Colors.BLACK.getColor());
}
else if (isaLeftEye(yCoordinate, xCoordinate)) {
if (isaLeftEyePupil(yCoordinate, xCoordinate)) {
System.out.print(Colors.PURPLE.getColor());
} else {
System.out.print(Colors.BLUE.getColor());
}
}
else if (isaRightEye(yCoordinate, xCoordinate)) {
if (isaRightEyePupil(yCoordinate, xCoordinate)) {
System.out.print(Colors.PURPLE.getColor());
} else {
System.out.print(Colors.BLUE.getColor());
}
}
else if (isaNose(yCoordinate, xCoordinate)) {
System.out.print(Colors.BLACK.getColor());
}
else if (isaMouth(yCoordinate, xCoordinate)) {
if (isaTongue(yCoordinate, xCoordinate)) {
System.out.print(Colors.RED.getColor());
} else {
System.out.print(Colors.CYAN.getColor());
}
}
else {
System.out.print(Colors.WHITE.getColor());
}
private static boolean isaTongue(int yCoordinate, int xCoordinate) {
return xCoordinate > 45 && xCoordinate < 59 && yCoordinate > 34 && yCoordinate < 38;
}
private static boolean isaMouth(int yCoordinate, int xCoordinate) {
return xCoordinate > 42 && xCoordinate < 62 && yCoordinate > 30 && yCoordinate < 38;
}
private static boolean isaNose(int yCoordinate, int xCoordinate) {
return xCoordinate > 50 && xCoordinate < 57 && yCoordinate > 25 && yCoordinate < 28;
}
private static boolean isaRightEyePupil(int yCoordinate, int xCoordinate) {
return xCoordinate > 65 && xCoordinate < 72 && yCoordinate > 22 && yCoordinate < 27;
}
private static boolean isaRightEye(int yCoordinate, int xCoordinate) {
return xCoordinate > 62 && xCoordinate < 72 && yCoordinate > 17 && yCoordinate < 27;
}
private static boolean isaLeftEyePupil(int yCoordinate, int xCoordinate) {
return xCoordinate > 35 && xCoordinate < 42 && yCoordinate > 22 && yCoordinate < 27;
}
private static boolean isaLeftEye(int yCoordinate, int xCoordinate) {
return xCoordinate > 32 && xCoordinate < 42 && yCoordinate > 17 && yCoordinate < 27;
}
private static boolean isaRightEyeBrow(int yCoordinate, int xCoordinate) {
return xCoordinate > 60 && xCoordinate < 72 && yCoordinate > 14 && yCoordinate < 17;
}
private static boolean isaLeftEyeBrow(int yCoordinate, int xCoordinate) {
return xCoordinate > 30 && xCoordinate < 42 && yCoordinate > 14 && yCoordinate < 17;
}
- In de Colors.class zijn er twee links met documentatie en een korte uitleg hoe je je eigen kleur kiest.
Easter eggs are a well-known phenomenon in software. Most customers don’t appreciate it if you put some in production code, so here is your moment! Grab your Java paint bucket and your keyboard and create, literally, the most incredible easter egg. Use our starting template and decorate the egg in the most creative way. Maybe you can even make it animate like a flipbook?
- The Easter egg must be printed in your console.
- It is not the intention that the Easter egg block is made in a println (), and then printed out. That is why we only judge Easter eggs that are generated based on code algorithm. For example, what is not allowed:
public void drawEgg() {
println(" _ ");
println(" _(\")_ ");
println("(_ . _)");
println(" / : \\ ");
println("(_/ \\_)");
}
- The code is written in Java
- The code can be found at GitHub and Fork the repo from https://github.com/SogetiEasterEgg/SogetiEasterEggChallenge2021
- This fork is shared with [email protected] before 29-03-2021
if (isaLeftEyeBrow(yCoordinate, xCoordinate)) {
System.out.print(Colors.BLACK.getColor());
}
else if (isaRightEyeBrow(yCoordinate, xCoordinate)) {
System.out.print(Colors.BLACK.getColor());
}
else if (isaLeftEye(yCoordinate, xCoordinate)) {
if (isaLeftEyePupil(yCoordinate, xCoordinate)) {
System.out.print(Colors.PURPLE.getColor());
} else {
System.out.print(Colors.BLUE.getColor());
}
}
else if (isaRightEye(yCoordinate, xCoordinate)) {
if (isaRightEyePupil(yCoordinate, xCoordinate)) {
System.out.print(Colors.PURPLE.getColor());
} else {
System.out.print(Colors.BLUE.getColor());
}
}
else if (isaNose(yCoordinate, xCoordinate)) {
System.out.print(Colors.BLACK.getColor());
}
else if (isaMouth(yCoordinate, xCoordinate)) {
if (isaTongue(yCoordinate, xCoordinate)) {
System.out.print(Colors.RED.getColor());
} else {
System.out.print(Colors.CYAN.getColor());
}
}
else {
System.out.print(Colors.WHITE.getColor());
}
private static boolean isaTongue(int yCoordinate, int xCoordinate) {
return xCoordinate > 45 && xCoordinate < 59 && yCoordinate > 34 && yCoordinate < 38;
}
private static boolean isaMouth(int yCoordinate, int xCoordinate) {
return xCoordinate > 42 && xCoordinate < 62 && yCoordinate > 30 && yCoordinate < 38;
}
private static boolean isaNose(int yCoordinate, int xCoordinate) {
return xCoordinate > 50 && xCoordinate < 57 && yCoordinate > 25 && yCoordinate < 28;
}
private static boolean isaRightEyePupil(int yCoordinate, int xCoordinate) {
return xCoordinate > 65 && xCoordinate < 72 && yCoordinate > 22 && yCoordinate < 27;
}
private static boolean isaRightEye(int yCoordinate, int xCoordinate) {
return xCoordinate > 62 && xCoordinate < 72 && yCoordinate > 17 && yCoordinate < 27;
}
private static boolean isaLeftEyePupil(int yCoordinate, int xCoordinate) {
return xCoordinate > 35 && xCoordinate < 42 && yCoordinate > 22 && yCoordinate < 27;
}
private static boolean isaLeftEye(int yCoordinate, int xCoordinate) {
return xCoordinate > 32 && xCoordinate < 42 && yCoordinate > 17 && yCoordinate < 27;
}
private static boolean isaRightEyeBrow(int yCoordinate, int xCoordinate) {
return xCoordinate > 60 && xCoordinate < 72 && yCoordinate > 14 && yCoordinate < 17;
}
private static boolean isaLeftEyeBrow(int yCoordinate, int xCoordinate) {
return xCoordinate > 30 && xCoordinate < 42 && yCoordinate > 14 && yCoordinate < 17;
}
- In the Colors.class there are two links with documentation and short explanation how to choose your own color.