Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   pokereval() (https://forums.graalonline.com/forums/showthread.php?t=82788)

Chompy 11-16-2008 01:12 AM

pokereval()
 
Could this function (for example when "holdem" is the game type) be fixed so that when given 5 common cards and 3 dead cards, it will give 100%, 0% or 50%, no matter what iteration is given.

Here's some examples:

NPC Code:

Player 1: hearts_10,diamonds_queen
Player 2: spades_3,spades_10
Player 1: 40%
Player 2: 60%
Trashing one card and dealing the flop...
Cards in the table: clubs_king,hearts_8,clubs_9
Player 1: 66%
Player 2: 33%
Trashing one card and dealing the turn...
Cards in the table: clubs_king,hearts_8,clubs_9,hearts_3
Player 1: 36%
Player 2: 64%
Trashing one card and dealing the river...
Cards in the table: clubs_king,hearts_8,clubs_9,hearts_3,spades_4
Player 1: 25%
Player 2: 75%



In the above example, player 1 = winner with pair in 3 (should be 100%)



Next example..

NPC Code:

Player 1: diamonds_10,spades_7
Player 2: spades_8,hearts_10
Player 1: 60%
Player 2: 40%
Trashing one card and dealing the flop...
Cards in the table: diamonds_7,hearts_9,clubs_2
Player 1: 62%
Player 2: 37%
Trashing one card and dealing the turn...
Cards in the table: diamonds_7,hearts_9,clubs_2,clubs_queen
Player 1: 72%
Player 2: 28%
Trashing one card and dealing the river...
Cards in the table: diamonds_7,hearts_9,clubs_2,clubs_queen,clubs_ace
Player 1: 50%
Player 2: 50%



I have no idea why it shows it as 50/50 when it should show 100% to player 1 with a winning hand of pair in 7..

So, could the function be made to give 100% or 0% (and only 50% when it's a split) after the river card? (When 5 common cards and 3 dead cards are given as parameters)

thatdwarf 11-16-2008 04:44 AM

I'm going to assume you have some kind of a conditional checking each hand and comparing them to one another after the river card?


If anything just do a straight assignment if you're just incrimenting the percentage as you go once a winning hand is determined

cbk1994 11-16-2008 06:22 AM

Quote:

Originally Posted by thatdwarf (Post 1442589)
I'm going to assume you have some kind of a conditional checking each hand and comparing them to one another after the river card?


If anything just do a straight assignment if you're just incrimenting the percentage as you go once a winning hand is determined

pokereval() is a built-in function. Stefan loves poker.

Quote:

Script help for 'pokereval':
pokereval(str, obj, obj, obj, int) - returns object - returns an array of chance to win a poker game, parameters are the poker type (holdem, holdem8, omaha, omaha8, 7stud, 7stud8, 7studnsq, razz, lowball27), an array of each players cards ({{"as","ah"},{"kd","kc"}}), the common cards, the dead cards and number of iterations

Chompy 11-16-2008 09:26 PM

Yes, I'm talking about the in-built one (Thanks Chris for pointing it out).

So, Stefan, think it could be fixed?

Admins 11-18-2008 11:23 PM

The function has been added for Adrenaline Poker. It's normally only used for calculating the chance that a bot is winning so that it can base it's decisions on it, it's currently not used though. I'm not sure if it can also be used to calculate which player is actually winning, but may be it can and the parameters are just not correctly given, so may be post an example of the parameters you are giving to the function (dead cards should be empty for holdem).

Chompy 11-18-2008 11:44 PM

PHP Code:

function onCreated() {
  echo(
pokereval("holdem", {{"6d","qc"}, {"9c","7h"}}, {"3s","kc","10c","3d","8d"}, ""1));


Randomly goes between (1, 0) (0.5, 0.5) and (0.75, 0.25) - If i raise the iteration it will for example move up to alot of commas (0.8225,0.1775)

Was thinking of using the function for card games (poker of course :p) and such and I needed a way to determine the winner of the pot


All times are GMT +2. The time now is 12:11 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.