Hello b I need your help for my homework, any brains here? what you are seeing are all possible combinations of all high cards of a deck of cards {T, J, Q, K, A} the letters to the side of each one represent the colors, {a,b,c,d} What I want is the total combinations of this data where no letter that represents the color is repeated like {Ta, Ja, Kb} How is it possible to get such information?
Hello b I need your help for my homework, any brains here...
Other urls found in this thread:
rextester.com
file.io
file.io
file.io
twitter.com
Also the data is represented in groups of three, image related. forgot to say that.
I can't do math but look at this
im confused as to what this means
NYPA
>any brains here
Kek
lmao
thank u
If OP is still here and really needs this that badly i can write an sql script to do this. and then it would save all the values.... still here?
This man is a genius. If you look closely, you can see that he's outlined a cock
Im here and I would love that bro is it too hard to do in sql?
no dont think so. give me a few. ill send script and vals
Why write a script to save values when you can just right click the image?
HELL YEAH DUDE
I dont think you understood the problem...
A b C d is the colours? War. There isn't 4 colours in a deck there's 4 suits
Anyway simple enough but your homework is probably to show your working not just brute force the answer with script
I only need the answer, also I associated the suits with colors like pic related, more practical for what im trying to do
In the algorithm that is making the groups just have it not add a card with the same color, for example if the first card is of color a the second card can only be {b, c, d} so if the second card is b then the third card can be {c, d}.
just have the set of colors get smaller when you go to choose a new card
ayo that is pretty clever are you a programmer?
im still here got side tracked. almost done
cool dude dont worry
Reporting In
Think of it this way;
You have 5 high cards, 4 "colors" of each, so a total of 20 suitedCards
for each suitedCard, there are 19 remaining suitedCards, 4 of which are of the same suit
This leaves you with 15 otherSuitedCards, of which you need every possible combination of 2
So foreach otherSuitedCard there is 14 remaining suited cards, 4 of which are the same suit
This leaves you with 10 finalSuitedCards
Now work backwards.
10 final suited cards means its only possible to have 10 combinations of two
10 2 pair combinations available for each of the 20 suited cards
200 total possible outcomes where 3 distinct cards are selected and no suit repeats
dude you are a total genius, I would love to have your brain, also thanks so much for helping
also is there a way to know if you are correct? the logic seems good but just for checking
Sure
I also happen to be a programmer so I will write you some code to prove my hypothesis
No idea what the other dude is wrong, be interesting to compare tbh
No idea what the other side is writing* it shouldn't take this long tbh
Yeah, bro. I'll send you the answer. Just PM me :)
Godspeed, I say you are right because the total combination of all high cards is 560 and without a suit repeating 200 seems possible, but only one way to know for sure
Not many posters here so if thread dies, keep an eye out on catalog, i will post a solution for you soon
will do bro thank you!
a = ['Ta', 'Ja', 'Qa', 'Ka', 'Aa']
b = ['Tb', 'Jb', 'Qb', 'Kb', 'Ab']
c = ['Tc', 'Jc', 'Qc', 'Kc', 'Ac']
d = ['Td', 'Jd', 'Qd', 'Kd', 'Ad']
cd = ['Tc', 'Jc', 'Qc', 'Kc', 'Ac', 'Td', 'Jd', 'Qd', 'Kd', 'Ad']
counter = 0
for a_card in a:
for b_card in b:
for cd_card in cd:
counter +=1
print([a_card, b_card, cd_card], counter)
No wonder it was taking forever..
Your program cannot produce a result equivalent to "Ta" "Tc" "Td" which is a valid result according to the problem.
try again (my solution still inbound)
good eye, so if this returns 125 results
a = ['Ta', 'Ja', 'Qa', 'Ka', 'Aa']
b = ['Tb', 'Jb', 'Qb', 'Kb', 'Ab']
c = ['Tc', 'Jc', 'Qc', 'Kc', 'Ac']
counter = 0
for a_card in a:
for b_card in b:
for c_card in c:
counter +=1
print([a_card, b_card, c_card], counter)
then surely bcd and dba will return an extra 250, making it 375 in total?
I actually had the same issue, duplication caused unexpected result-counts so I did it a really lazy way
Validating this for flaws now, I expected a valid result of 200 tbh
new poster here. Think this works.
let color = {a,b,c,d}
let suits = {T, J, Q, K, A}
counter = 0
For c1 in range(1):
For c2 in range(c1+1, 2):
For c3 in range(c2+1, 3):
For i,j,k in range(4):
counter +=1
Card1 = i+c1
Card2 = j+c2
Card3 = k+c3
print([Card1, Card2, Card3])
Oops this was dumb of me, replace the i with suits[i], similar for j, k. Replace c1 with color[c1], similar for c2, c3.
Jesus... not me... This is the sql guy .
here. its a notepad. it has 1821 values. all distinct. use the column that says ConCatValString
file.io
oops column names didnt copy
these are to names
id Val1 Val2 Val3 ConcatValstring Perm2 Perm3 Perm4 Perm5 Perm6
file.io
notepad file. the code in sql
Actually I am confident in the outcome now that I think about it. I apologise OP, my quik maffs did not account for unordered duplicates whereas my application does
Dude... wat. Your 3rd line is "Ta,Tb,Ja" which violates the premise which is that all 3 cards must be of a different suit
oh shit. i did all possible with no repeats. i can change it.
I believe you, but how is it not 500?
(4*5) options for first card
*(3*5) for second card
*(2*5) for third
/6 for permutations of three-card sets
=500
Wow. coding/scripting/programming is way outta my pay grade. I just jumped in this thread to gauge how dumb I am. lol
just here to say this is wholesome and that i am stupid thanks for putting a smile on my face anons
I believe you, but how is it not 500?
(4*5) options for first card
*(3*5) for second card
*(2*5) for third
/6 for permutations of three-card sets
okay yes, agreed! Thought I was going crazy haha
Didn't understand though, person replying said 200 which is definitely wrong.
The person who said 200 was me. I am definitely wrong because I failed to take into account unordered duplicates and instead did lazy extrapolation of the last 2 which was erroneous thinking on my behalf
In my practical example, seen here: each resultset is hashed into (cardcardcard)(suitsuitsuit) with each section sorted, so that if the result was Ta Ac Tb the hash is ATTabc, this is then checked against hashes of accepted results to guarantee no duplicates are accepted in any order (eg: A duplicate of Tb Ta Ac would still hash into ATTabc)
bumping while my potato churns away
sql dude still here. I think i got some thing in a min. just checking stuff
what i got now. no same 'color' now.
sorry count is 560. and link
file.io
i m kinda buzzed
idk like
5p3 * 4!
why brute force this
?
I'm a data programmer and it seemed interesting to solve from a data programming (T-SQL) standpoint. It seems brute forced because sql works with data stored in tables. So you can select from all possibilities using more and more rules. It's a rule based approach.
I found it interesting. anyway ill post code. File.io doesnt let you post sql code so ill find a place. i dont use github. I'm fairly sure its right though...
could be wrong
use test
Set nocount on
Declare @Val1 as int
Declare @Val2 as int
Declare @Val3 as int
Declare @Concat as nvarchar(50)
Declare @Perm2 as nvarchar(50)
Declare @Perm3 as nvarchar(50)
Declare @Perm4 as nvarchar(50)
Declare @Perm5 as nvarchar(50)
Declare @Perm6 as nvarchar(50)
Set @Val1=0
Set @Val2=0
Set @Val3=0
set @Concat= ''
set @Perm2 = ''
set @perm3 = ''
set @perm4 = ''
set @perm5 = ''
set @perm6 = ''
--need a cursor to iterate the permutation check and create manual table ids
--Table Cards has the card names
Declare @cur as int
set @cur=0
Delete FaggotOPsCardHomework --clear previous vals This table stores the list of id vals and strings perms
WHILE @Val1
--Write Values for the string of letters
Set @Concat = (Select CardText from Cards Where id=@Val1) + ',' +(Select CardText From Cards Where id = @Val2) + ',' + (Select CardText From Cards Where id=@Val3)
Set @Perm2 = (Select CardText from Cards Where id=@Val2) + ',' +(Select CardText From Cards Where id = @Val3) + ',' + (Select CardText From Cards Where id=@Val1)
Set @Perm3 = (Select CardText from Cards Where id=@Val3) + ',' +(Select CardText From Cards Where id = @Val1) + ',' + (Select CardText From Cards Where id=@Val2)
Set @Perm4 = (Select CardText from Cards Where id=@Val1) + ',' +(Select CardText From Cards Where id = @Val3) + ',' + (Select CardText From Cards Where id=@Val2)
Set @Perm5 = (Select CardText from Cards Where id=@Val2) + ',' +(Select CardText From Cards Where id = @Val1) + ',' + (Select CardText From Cards Where id=@Val3)
Set @Perm6 = (Select CardText from Cards Where id=@Val1) + ',' +(Select CardText From Cards Where id = @Val2) + ',' + (Select CardText From Cards Where id=@Val3)
END
--Remove dupes cause cant have same value in each set
delete from FaggotOPsCardHomework where Val1=Val2 OR Val2=Val3 OR Val3=Val1 OR VAl1=Val3
Delete from base --reset tablr
set @cur = 0
While @cur< (Select count(*) from FaggotOPsCardHomework)+1 --read each record in the table one at a time and evaluate against all rows and columns
begin
set @cur = @cur + 1
insert into base select * From FaggotOPsCardHomework where --
FaggotOPsCardHomework.ConcatValstring Not in (Select ConcatValstring from Base)--compairs agains all perms in base where the main list is stored for being unique
AND FaggotOPsCardHomework.ConcatValstring NOT in (Select Perm2 from Base)
AND FaggotOPsCardHomework.ConcatValstring Not in (Select Perm3 from Base)
AND FaggotOPsCardHomework.ConcatValstring Not in (Select Perm4 from Base)
AND FaggotOPsCardHomework.ConcatValstring Not in (Select Perm4 from Base)
AND FaggotOPsCardHomework.ConcatValstring Not in (Select Perm5 from Base)
AND FaggotOPsCardHomework.ConcatValstring Not in (Select Perm6 from Base)
AND FaggotOPsCardHomework.id = @cur --reads current reacord
End;
with SetA as (
Select Concatvalstring from base where len(Replace(concatvalstring, 'a','')) < len(Concatvalstring)-1
union all
Select Concatvalstring from base where len(Replace(concatvalstring, 'b','')) < len(Concatvalstring)-1
union all
Select Concatvalstring from base where len(Replace(concatvalstring, 'c','')) < len(Concatvalstring)-1
union all
Select Concatvalstring from base where len(Replace(concatvalstring, 'd','')) < len(Concatvalstring)-1
)
select distinct * from base where concatvalstring not in (select * from SetA)
order by val1,val2,val3
Haha, look at retard over here
also please excuse my shit formatting and case consistency. i usually just use a beautifier. im lazy.
I'm OP and I want to thank all of you who put some of your time into this, you guys are amazing, I got busy and couldn't reply but now I'm here and all check it all, thanks again!
wait dude imagine the kind of software you can make with your knowledge in poker holy shit