Paired Flops

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Paired Flops

Postby frauke » Mon Jun 23, 2008 12:05 pm

Hi, I just started to play around with the functions and tried to build a report that filters me all paired Flops. How to achieve this?
I thought I could compare the FlopCards with each other, but have no real idea how to do this?
How can I adress the different cards 2 to Ace, so fe.g if I´d like to get an appropriate to "if (Turn=Ace.heart)" or "if(flopvalue1=flopvalue2)" etc?

Hope you know what I mean. Thank you!
frauke
 
Posts: 3
Joined: Mon Jun 23, 2008 11:52 am

Re: Paired Flops

Postby Seitz333 » Mon Jun 23, 2008 4:57 pm

Are you wanting a custom report to view in PT3, or are you wanting a custom SQL statement that is viewed using pgAdmin?
Seitz333
 
Posts: 71
Joined: Sun Feb 24, 2008 8:14 pm

Re: Paired Flops

Postby frauke » Mon Jun 23, 2008 6:03 pm

I want to create a custom Report in PT3.
frauke
 
Posts: 3
Joined: Mon Jun 23, 2008 11:52 am

Re: Paired Flops

Postby Seitz333 » Tue Jun 24, 2008 11:44 am

I'm pretty good with pgAdmin and the SQL statements but I have not used the custom reports feature in PT3. Hopefully someone will jump in here and give you a hand with the custom report.

Chuck
Seitz333
 
Posts: 71
Joined: Sun Feb 24, 2008 8:14 pm

Re: Paired Flops

Postby kraada » Tue Jun 24, 2008 5:07 pm

So, the different flop cards are id_flop1, id_flop2 and id_flop3.

The cards are stored as a number, I'm not sure whether it goes up from 0 being the As or from 0 being the 2c, but they go in order: 2c + 1 = 3c, 3c + 1 = 4c, etc.

The last piece you need here is the modulo function (%) which returns the remainder when divided by the number in question ( so 8 % 3 = 2, for example).

What this amounts to is you can write the report with the filter:
(id_flop1 % 13 = id_flop2 % 13) OR (id_flop1 % 13 = id_flop3 % 13) OR (id_flop2 % 13 = id_flop3 % 13)

This works because if you enumerate card numbers in the fashion described, since there are 52 cards in a deck and 4 * 13 = 52. As such if you find the remainder when dividing by 13 you will always end up with the same card rank.

Incidentally, this query takes quite a while . . .

Edit: And apparently uses a lot of RAM. I just got a "you're low on resources" message indicating that my 1G of ram and 1G of swap are both nearly taxed out. Maybe there's a better way to do this as a custom stat and then you can just filter on the stat being true? I'm not sure I'll have to look into it.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Paired Flops

Postby frauke » Tue Jun 24, 2008 7:07 pm

Thank you kraada. Cant try it at the moment, but will look into it later. I am at least happy that its possible, I was searching for Filters like that for months because you can creat lots of useful stuff with it.
Let me hear any update, as i said I will look into it too, coming from a programming background. Should be possible to do this resource friendly I hope.
Thanks again.
frauke
 
Posts: 3
Joined: Mon Jun 23, 2008 11:52 am


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 5 guests