Bounty Ended with 50 reputation awarded by Mego♦ occurred Nov 15 '17 at 4:43 8 Bug fix with incorrect order of Fates and turn-counter with Flames/Rogue edited Nov 9 '17 at 21:53 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?6:F>0t=F>0?-1:t<1?6:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like six or seven or eight mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1t=F>0? // If the turn-counter is 0 or -1 (none): 6 // Set the turn-counter to 6 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) :t<1? // Else-if the turn-counter is 0 or -1 (none): 6 // Set the turn-counter to 6 : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?6:F>0?-1:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like six or seven mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 6 // Set the turn-counter to 6 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=F>0?-1:t<1?6:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like seven or eight mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=F>0? // If the Fates-flag is active: -1 // Set the turn-counter to -1 (none) :t<1? // Else-if the turn-counter is 0 or -1 (none): 6 // Set the turn-counter to 6 : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  7 Fixed five turns after Flames/Rogue instead of four edited Nov 9 '17 at 13:11 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?56:F>0?-1:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like five or six or seven mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 56 // Set the turn-counter to 56 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?5:F>0?-1:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like five or six mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 5 // Set the turn-counter to 5 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?6:F>0?-1:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like six or seven mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 6 // Set the turn-counter to 6 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  6 Fixed Skull when no wishes or fates are available edited Nov 9 '17 at 12:58 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?5:F>0?-1:t;else if(c<5)t=F*w*W<1?-1:0;else-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  Ported the Python3 reference implementation in Java, and then golfed it down somewhat. Can definitely be golfed more, but this is just an initial version to make sure I did everything correct. If anyone spots any mistakes (it wouldn't surprise me if there are anyit wouldn't surprise me if there are any EDIT: Already fixed like five or six mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 5 // Set the turn-counter to 5 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive -1 // Set the turn-counter to -1 (none) : // Else: 0; -1; // Set the turn-counter to 0-1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?5:F>0?-1:t;else if(c<5)t=F*w*W<1?-1:0;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  Ported the Python3 reference implementation in Java, and then golfed it down somewhat. Can definitely be golfed more, but this is just an initial version to make sure I did everything correct. If anyone spots any mistakes (it wouldn't surprise me if there are any), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 5 // Set the turn-counter to 5 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive -1 // Set the turn-counter to -1 (none) : // Else: 0; // Set the turn-counter to 0 F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  v->{String r="";for(int i=10,d=22,c=d,F=0,t=0,w=0,W=0,j=Math.random()<.5?1:2;;c=d){c*=Math.random();r+=" "+c;if(c<1){F=1;r+=t>0?"F"+(F=0):"";t=-1;}else if(c<2){w+=Math.random()*3+1-(t>0?1:0);t=-1;}else if(c<4)t=t<1?5:F>0?-1:t;else if(c<5)t=F*w*W<1?1:-1;else if(c>19){t+=t>0?j:0;j=j%2+1;d--;}if(c>1&c<5&w*W>0){w--;W=(int)(Math.random()*3)%2;}i-=c==5?Math.random()*3+2:c==6?-2:0;r+=c>1&c<5&F>0?"F"+(F=0):c>0&c<5?"w"+w+"W"+W:c>4&c<7?"i"+i:"";if(--t==0|(c==5&i<4)|c>6&c<10)return r;}}  Ported the Python3 reference implementation in Java, and then golfed it down. Can definitely be golfed more, but this is just an initial version to make sure I did everything correct. If anyone spots any mistakes (it wouldn't surprise me if there are any EDIT: Already fixed like five or six mistakes since I posted this..), please let me know.v->{ // Method with empty unused parameter and String return-type String r=""; // Result-String, starting empty for(int i=10, // Intelligence d=22, // Amount of cards in the deck, starting at 22 c=d, // Current card drawn F=0, // Fates flag t=0, // Turn-counter w=0, // Wishes left W=0, // Wishes used flag j=Math.random()<.5?1:2; // Whether Jester/Fool is drawn first of the two ; // Loop indefinitely c=d){ // After every iteration, shuffle the deck (reset c) c*=Math.random(); // Draw a random 0-21 card (or less if Fool/Jester is gone) r+=" "+c; // Append the result with a space and this card if(c<1){ // If the card was Fates: F=1; // Set the Fates-flag to active r+=t>0? // If the turn-counter is larger than 0: "F"+(F=0) // Append that Fates was used (and make Fates inactive) : // Else: ""; // Append nothing t=-1;} // Set the turn-counter to -1 (none) else if(c<2){ // If the card was Moon instead: w+=Math.random()*3+1 // Increase the wishes by 1-3 randomly -(t>0? // Then, if the turn-counter is larger than 0 1 // Subtract 1 from the amount of wishes : // Else: 0); // Leave the wishes the same t=-1;} // Set the turn-counter to -1 (none) else if(c<4) // If the card was Flames or Rogue instead: t=t<1? // If the turn-counter is 0 or -1 (none): 5 // Set the turn-counter to 5 :F>0? // Else-if the Fates-flag is active: -1 // Set the turn-counter to -1 (none) : // Else: t; // Leave the turn-counter the same else if(c<5){ // If the card was Skull instead: t=F // If the Fates-flag is inactive *w // or the amount of wishes is smaller than 1 *W<1? // or the wishes used flag is inactive 1 // Set the turn-counter to 1 : // Else: -1; // Set the turn-counter to -1 (none) F=0;} // Then set the Fates-flag to inactive else if(c>19){ // If the card was Fool or Jester instead: t+=t>0? // If the turn-counter was not 0 or -1 (none): j // Increase either by 1 (Fool) or 2 (Jester) : // Else: 0; // Leave the turn-counter the same j=j%2+1; // Fix j (2->1; 1->2) d--;} // And remove the Fool/Jester from the Deck if(c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &w // and the amount of wishes is at least 1, *W>0){ // and the wishes used flag is active w--; // Decrease the amount of wishes by 1 W=(int)(Math.random()*3)%2;} // And set the wishes used flag to one of (0,0,1) i-=c==5? // If the card drawn was Idiot: Math.random()*3+2 // Decrease the intelligence by 2-5 randomly :c==6? // Else-if the card drawn was Star: -2 // Increase the intelligence by 2 : // Else: 0; // Leave the intelligence the same r+=c>1&c<5 // If the card drawn was Flames, Rogue or Skull, &F>0? // and Fates is active "F"+(F=0) // Append that Fates was used (and make Fates inactive) :c>0&c<5? // Else-if the card drawn was Moon, Flames, Rogue or Skull: "w"+w+"W"+W // Append the amount of wishes left and wishes used flag :c>4&c<7? // Else-if the card drawn was Idiot or Star: "i"+i // Append the amount of intelligence left : // Else: ""; // Append nothing if(--t // Decrease the turn-counter by 1 ==0 // And if the turn-counter is now 0, |(c==5 // or the card drawn was Idiot, &i<4) // and the intelligence dropped below 4, |c>6&c<10) // or the card drawn was Donjon, Void or Talons: return r; // Return the result of the game } // End of loop } // End of method  5 -1 byte, lol.. edited Nov 8 '17 at 20:49 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges 4 Wasn't outputting Fates used yet.. edited Nov 8 '17 at 20:10 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges 3 edited body edited Nov 8 '17 at 19:00 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges 2 added 1132 characters in body edited Nov 8 '17 at 18:54 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges 1 answered Nov 8 '17 at 18:34 Kevin Cruijssen 47.9k77 gold badges8383 silver badges241241 bronze badges