Setting php values in php-fpm confs instead of php.ini
Yes, you're right - If you specify these values in php-fpm pool config file, it will override "default" values in php.ini
config file - but only for this FPM pool.
In addition to this, remember that some of php directives could be defined as php_admin_value
and php_admin_flag
as described in PHP Documentation (see the bottom of page).
Related videos on Youtube
Adriann
Updated on September 18, 2022Comments
-
Adriann over 1 year
I made up a quick poker game. It generates 5 random numbers and converts those numbers into actual cards values and symbols based on their value. However, I have problems when it comes to making the hand evaluation.
So far I only did the flush right as it's really easy but even then it's not perfect (it prints that the user has a flush 5 times... ) and I would really appreciate if someone could help me with the pair, two pair, three of a kind and straight. I could do the rest afterwards but I just need a heads-up on how to do those.
Thank you in advance for your help, here is the code :
package tests; import java.util.*; public class TESTS { public static void main(String[] args) { boolean[] pack = new boolean[52]; // Array to not generate the same number twice int[] cards = new int[5]; //The 5 unique random numbers are stored in here. String[] cardsvalues = new String[5]; // This will assign the card's value based on the random number's value char[] cardssymbols = new char[5];//This will assign the card's symbol based on the random number's value char symbols[] = {'♥', '♦', '♣', '♠'}; // possible symbols that the random number can take String values[] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"}; // possible values that the random number can take Random give = new Random(); for (int i = 0; i < cards.length; i++) { // Gives 5 unique random numbers do { cards[i] = give.nextInt(52); } while (pack[cards[i]]); pack[cards[i]] = true; System.out.println(cards[i]); } for (int i = 0; i < cards.length; i++) { // This converts the number to a card symbol based on the number's value final int numOfSymbol = cards[i] / 13; cardssymbols[i] = symbols[numOfSymbol]; } for (int i = 0; i < cards.length; i++) { // This converts the number to an actual card value based on the number's value. final int numOfValues = cards[i] % 13; cardsvalues[i] = values[numOfValues]; } for (int i = 0; i < cardssymbols.length; i++) { // Prints the actual cards once they are converted System.out.print(cardssymbols[i]); System.out.println(cardsvalues[i]); } for (int i = 0; i < cardsvalues.length; i++) { //Here is the problem, i have no idea on how to make the handevaluator ... if (cardsvalues[i] == cardsvalues[i] + 1) { System.out.println("PAIR !!!"); } else if (cardsvalues[i] == cardsvalues[i] + 1 && cardsvalues[i] == cardsvalues[i] + 2) { System.out.println("TRIPS !!!"); } else if (cardssymbols[0] == cardssymbols[1] && cardssymbols[1] == cardssymbols[2] && cardssymbols[2] == cardssymbols[3] && cardssymbols[3] == cardssymbols[4]) { System.out.println("FLUSHHH"); } } }
-
Taemyr over 7 yearsStep one. Get rid of the switches.
-
Timothy Truckle over 7 yearsstep two: think before you type: what sense does it make to check the deck itself?
-
Adriann over 7 yearsI don't understand why should I get rid of the switches ?
-
Artur Biesiadowski over 7 yearsJust write something like
cardssymbols[i] = symbols[cards[i]/13]
instead of decoding it in switch - same for values. Thats first step, there are many more before code starts to be usable. -
Alykoff Gali over 7 yearsYou have wrong code. In your code the player may hold the same cards.
-
Adriann over 7 yearsHow can he have the same cards ? The first "for" condition in my code gives 5 unique numbers ...
-
Taemyr over 7 years@Adriann You don't need to. But you need to understand your code well enough to see that the switch is the wrong approach.
-
Adriann over 7 years@Taemyr Yes, I've changed the switches as you can see in the code, thank you :) but it still doesn't resolve my starting problem :(
-
Taemyr over 7 yearsCan you write code that creates an array of length 13 that counts how many instances of each value you have?
-
Adriann over 7 yearsWhat would that be for ? prove that I can have the same cards ?
-
Taemyr over 7 yearsCan you write code that takes an array of counts of different values and decides if there are some values that you have a pair of?
-
Adriann over 7 yearsI think I did it for the pair: for (int i = 0; i < cardsvalues.length; i++) { for (int k = i + 1; k < cardsvalues.length; k++) { if (cardsvalues[i] == cardsvalues[k]) { System.out.println("PAIR !!!"); } } }
-
-
Lee Daniel Crocker over 7 yearsEven better if make the rank values 2,3,...K,A, so you can compare ranks directly in their proper poker order. You still have to special-case the wheel, but you eliminate the special cases everywhere else.
-
meriton over 7 yearsFixed the rank order. Not sure what you mean by "the wheel"?
-
Lee Daniel Crocker over 7 years"Wheel" is poker slang for the straight A2345, or in your case, 0,1,2,3,12. It's always a bit of a hassle.