WinHoldEm formulas are very similar to the C programming expression syntax.
If you already know and understand C programming expressions then this
tutorial may serve as a convenient reference. If you are a beginner to the C
programming syntax then we hope you find this primer useful.
Everything described here is standard ANSI C except where specifically noted otherwise.
The general syntax for WinHoldem formulas is same as that of the C programming language.
For the C programmers out there, you should feel right at home.
For the uninitiated it will seem cryptic at first,
but you know you've always wanted to learn C.
Here's your chance.
Welcome to the club.
The formulas are strict R-VALUES (right side of an assignment expression).
There is no assignment operator.
All values are stored as (double) floating point values on the expression stack.
For bitwise operations the values are first converted to (int) and then the operator is applied.
Operator Precedence | ||
---|---|---|
category | operator | associativity |
Exponentiation* | ** ln | Right to Left |
Unary | ! ~ - ` | Right to Left |
Multiplicative | * / % | Left to Right |
Additive | + - | Left to Right |
Bitwise Shift | << >> | Left to Right |
Relational | < > <= >= | Left to Right |
Equality | == != | Left to Right |
Bitwise AND | & | Left to Right |
Bitwise XOR | ^ | Left to Right |
Bitwise OR | | | Left to Right |
Logical AND | && | Left to Right |
Logical XOR* | ^^ | Left to Right |
Logical OR | || | Left to Right |
Conditional | ?: | Right to Left |
Group * | () [] {} | Left to Right |
A boolean expression is composed of LOGICAL OPERATORS and OPERANDS. All boolean operands have only two values - true false. Each LOGICAL OPERAND has a very well defined operation upon the OPERAND(S) in the expression, with a very well defined result.
When any numeric value is used in conjunction with a LOGICAL
operator
any zero values are considered to be false (0)
any non-zero values are considered to be true (1)
Put very simply, if the numeric value in question is not zero
then it is considered to be true for boolean purposes.
Numeric Boolean Values | |
---|---|
Numeric Value | Boolean Value |
0 | false |
1 | true |
other | true |
Logical Operators | |
---|---|
Operator Name | Operator Token |
NOT | ! |
AND | && |
OR | || |
XOR | ^^ |
A unary operator takes a single operand.
Natural Log ln
Logical NOT !
Bitwise NOT ~
Unary Minus -
Bit Count `
A good example is the minus sign when it is used
to alter the sign of a value.
Example: a + b / -4
The minus sign in front of the 4 is a unary minus.
BIT COUNT 32-bit example | |
---|---|
a | `a |
0000000000000000000000000000000 | 0 |
0000000000000100000000000000000 | 1 |
0000010000000100000000000010000 | 3 |
1111111111111111111111111111111 | 32 |
a ** b
Standard algebraic exponentiation on a and b.
a is raised to the power of b.
ln a
Standard algebraic natural log of a
a == e ** (ln a)
e == ln(1)
e == 2.71828182845905
a * b
Standard algebraic multiplication on a and b.
a / b
Standard algebraic division on a and b.
a % b
Standard algebraic modulo on a and b.
a + b
Standard algebraic addition on a and b.
a - b
Standard algebraic subtraction on a and b.
a LOGICAL NOT operation on a bit by bit basis
BITWISE NOT 32-bit example | |
---|---|
expression | binary |
a | 11001001011101010110010101111010 |
~a | 00110110100010101001101010000101 |
a LOGICAL AND operation on a bit by bit basis
BITWISE AND 32-bit example | |
---|---|
expression | binary |
a | 11001001011101010110010101111010 |
b | 01001010010100101110001010101111 |
a&b | 01001000010100000110000000101010 |
a LOGICAL OR operation on a bit by bit basis
BITWISE OR 32-bit example | |
---|---|
expression | binary |
a | 11001001011101010110010101111010 |
b | 01001010010100101110001010101111 |
a|b | 11001011011101111110011111111111 |
a LOGICAL XOR operation on a bit by bit basis
BITWISE XOR 32-bit example | |
---|---|
expression | binary |
a | 11001001011101010110010101111010 |
b | 01001010010100101110001010101111 |
a^b | 10000011001001111000011111010101 |
Slide the entire bit pattern to the left by N
BITWISE SHIFTLEFT 32-bit example | |
---|---|
expression | binary |
a | 11001001011101010110010101111010 |
a<<1 | 10010010111010101100101011110100 |
a<<7 | 10111010101100101011110100000000 |
a<<31 | 00000000000000000000000000000000 |
a<<32 | 11001001011101010110010101111010 |
Slide the entire bit pattern to the right by N
BITWISE SHIFTRIGHT 32-bit example | |
---|---|
expression | binary |
a | 11001001011101010110010101111010 |
a>>1 | 11100100101110101011001010111101 |
a>>7 | 11111111100100101110101011001010 |
a>>31 | 11111111111111111111111111111111 |
a>>32 | 11001001011101010110010101111010 |
BITWISE SHIFTRIGHT 32-bit example | |
---|---|
expression | binary |
a | 01001001011101010110010101111010 |
a>>1 | 00100100101110101011001010111101 |
a>>7 | 00000000100100101110101011001010 |
a>>31 | 00000000000000000000000000000000 |
a>>32 | 01001001011101010110010101111010 |
false when the operand is true
true when the operand is false
LOGICAL NOT | |
---|---|
a | !a |
false | true |
true | false |
0 | 1 |
false when any operand is false
true when both operands are true
LOGICAL AND | ||
---|---|---|
a | b | a && b |
false | false | false |
false | true | false |
true | false | false |
true | true | true |
false when both operands are false
true when any operand is true
LOGICAL OR | ||
---|---|---|
a | b | a || b |
false | false | false |
false | true | true |
true | false | true |
true | true | true |
false when operands are boolean equal
true when operands are not boolean equal
LOGICAL XOR | ||
---|---|---|
a | b | a ^^ b |
false | false | false |
false | true | true |
true | false | true |
true | true | false |
LESS THAN | ||
---|---|---|
a | b | a < b |
-1 | 0 | true |
0 | 0 | false |
+1 | 0 | false |
GREATER THAN | ||
---|---|---|
a | b | a > b |
-1 | 0 | false |
0 | 0 | false |
+1 | 0 | true |
LESS THAN OR EQUAL | ||
---|---|---|
a | b | a <= b |
-1 | 0 | true |
0 | 0 | true |
+1 | 0 | false |
GREATER THAN OR EQUAL | ||
---|---|---|
a | b | a >= b |
-1 | 0 | false |
0 | 0 | true |
+1 | 0 | true |
EQUAL | ||
---|---|---|
a | b | a == b |
-1 | 0 | false |
0 | 0 | true |
+1 | 0 | false |
NOT EQUAL | ||
---|---|---|
a | b | a != b |
-1 | 0 | true |
0 | 0 | false |
+1 | 0 | true |
a ? b : c
Standard algorithmic if then else
If a then b else c
CONDITIONAL | |||
---|---|---|---|
a | b | c | a ? b : c |
true | any | any | b |
false | any | any | c |
Note that WinHoldEm uses the []{} operators differently than ANSI C.
Brackets [] and Braces {} are used by WinHoldEm as exlusive group operators.
The exclusive group operators cannot be nested.
They must be closed before starting another group of the same type.
The following example is allowable syntax:
{ [ a * (b+c) ] && [ d / (h-k) ] }
The following example is not allowable syntax:
{ { [ 2 + 3 ] * 2 } / 7 }
because this expression uses two open brace '{' groups simultaneously.
Also, note that parenthesis are not treated this way.
You can have multiple open parenthisis groups simultaneously.
By default all numeric constants are treated as double floating point values in base 10.
Floating Point Numeric Constants |
---|
123.456 |
0.987 |
192837465 |
.5 |
17. |
5.4321e-76 |
There are 4 additional integer options available as well that
allow you to select the base of the constant.
The 4 available bases are: 16, 8, 4, 2.
You must prefix a numeric constant with a zero
followed by a letter that selects the specific base you desire.
The letters to select each base are as follows:
Integer Numeric Base | ||
---|---|---|
Letter | Base | Name |
x | 16 | Hex |
o | 8 | Octal* |
q | 4 | Quadal* |
b | 2 | Binary* |
Integer Numeric Constants | ||||
---|---|---|---|---|
Decimal | Hex | Octal | Quadal | Binary |
0 | 0x0 | 0o0 | 0q0 | 0b0 |
1 | 0x1 | 0o1 | 0q1 | 0b1 |
2 | 0x2 | 0o2 | 0q2 | 0b10 |
3 | 0x3 | 0o3 | 0q3 | 0b11 |
4 | 0x4 | 0o4 | 0q10 | 0b100 |
5 | 0x5 | 0o5 | 0q11 | 0b101 |
6 | 0x6 | 0o6 | 0q12 | 0b110 |
7 | 0x7 | 0o7 | 0q13 | 0b111 |
8 | 0x8 | 0o10 | 0q20 | 0b1000 |
9 | 0x9 | 0o11 | 0q21 | 0b1001 |
10 | 0xa | 0o12 | 0q22 | 0b1010 |
11 | 0xb | 0o13 | 0q23 | 0b1011 |
12 | 0xc | 0o14 | 0q30 | 0b1100 |
13 | 0xd | 0o15 | 0q31 | 0b1101 |
14 | 0xe | 0o16 | 0q32 | 0b1110 |
15 | 0xf | 0o17 | 0q33 | 0b1111 |
16 | 0x10 | 0o20 | 0q100 | 0b10000 |
31 | 0x1f | 0o37 | 0q133 | 0b11111 |
63 | 0x3f | 0o77 | 0q333 | 0b111111 |
127 | 0x7f | 0o177 | 0q1333 | 0b1111111 |
255 | 0xff | 0o377 | 0q3333 | 0b11111111 |