« first day (3844 days earlier)      last day (1328 days later) » 

00:36
Hi guys, I have taken an approach and tried to code the first question. Can anyone please go through it and let me correct it? I still don't understand the question properly. Can someone check it out and let me know if its correct? Or suggest an alternative method? Link here. Thanks :D
@CoolCloud which part don't you understand? It seems clear enough to me.
you have TOTAL = 23 even though the description says 33 cards
@AndrasDeak oops, I took it to end the program quicker, updated.
@AndrasDeak Is the code satisfying the rules given? I have been scratching my head over this for a while.
@CoolCloud Why have you been scratching your head over it?
note that you have evaded my question of what you "don't understand [...] properly"
"I don't understand the problem" and "I don't know if my code is correct" are two very different statements.
@AndrasDeak The rules of user is what I dont understand. The rules of computer is specified, what about the user?
@CoolCloud the user is a user, who can choose whatever they want in each turn
the user is responsible for their own choices, you only have to program the computer
00:41
@AndrasDeak Even when the cards are less than 4?
@CoolCloud yes?
@AndrasDeak Okay cool, this was the first mistake I made during the competition, hence my code was wrong back then. Thankfully this version takes user input in each stage
A smart user will choose wisely (like the computer) when there are less than 4 cards, but this is not specified in the rules.
So does my code follow all the rules?
That I can't answer with the bandwidth I have available. Someone else might.
00:44
I think the if drawn == 0 and chance == 'user': is not something given inside the rules.
@AndrasDeak Sure man, thanks for the explanation :D
but there's a lot of repetition you can get rid of, like github.com/nihaalnz/Hackathon-Quests/blob/… where you can compute the choice for the cases and then do the rest of the work for all three cases
Like making a function?
not necessary right there
if drawn == 4:
    bot_choice = 3
elif drawn == 3:
    bot_choice = 2
elif drawn == 2:
    bot_choice = 1
drawn -= bot_choice
chance = 'user'
print(f'Cards left after bot drawn: {drawn}')
sorry, I misunderstood the case
so bot_choice = drawn - 1
@AndrasDeak Oh, that makes sense. I am dumb!!:p
@AndrasDeak So something liek this?
    elif 4 >= drawn >= 2:
        if chance == 'bot':
                bot_choice = drawn - 1
                drawn -= bot_choice
                print(f'Cards left after bot drawn: {drawn}')
you forgot chance = 'user'
Again there's probably a lot to be said about the overall design but I can't give you code review. It's near 3 AM here an I should go to bed.
00:55
Its fine, thanks and Good Night
night
and "chance" should probably be "turn", and "drawn" should probably be "cards_left"
Prolly, those names do sound better :p
01:46
anyone know how to explore an sqlite database?
I've got an sqlite database file and have no clue of what's in it
When I used it many years ago, there was available a freeware SQLite Database Browser. Might be Windows-only.
nice! thank you very much!
 
2 hours later…
03:28
cbg :D
hello
 
3 hours later…
06:18
@AndrasDeak OK yeah..I just tried to read the doc after 8 hours of coding..by the way, thanks.
@AndrasDeak yes. use this too.
 
2 hours later…
08:28
@python_user cbg
08:46
hey cool cloud, how is your algo training going along?
@python_user chat.stackoverflow.com/transcript/message/52060429#52060429 Its just worse, waiting for exams to get over
ahh I missed out on that, that is unfortunate, I knew you were working in your own zip_longestand the docs have a pure python implementation here docs.python.org/3/library/itertools.html#itertools.zip_longest in case you want to see
@python_user Hmmm, I think repeat is another itertools function?
yes, it is
Hmmmm interesting method, ill have to dig into it. I still haven't looked into iterators, generators, yield and all. But this seems interesting.
08:53
one step at a time :D
;p
Is there a dark theme for SO chat? My eyes O‿O
Hmmm this seems to be there
Does give a dark look. But the repo seems deleted.
I was using an "all in one" dark mode enabler, but I stopped using it, dark mode does not appeal to me much anymore :/
it is called "Dark Reader" it works on all websites
09:10
@CoolCloud that's the only one I'm aware of
It's probably unmaintained but it's legit
Oh I see. It's nice !
The code mode seems nice
rlemon was a JS room owner and regular. And Madara, excellent former mod and JS room owner ported it to firefox.
They both left and so did support
Oh that's sad.
09:28
indeed
09:42
@AndrasDeak What do you think about these, they wont get executed right? I mean the loop would exit before it reaches to those if?
@CoolCloud last time I checked it didn't exit
Hmmmmm
wow... my connection has gone really weird again... how the heck do I have a faster upload than download speed? scratches head
@JonClements australian ISP? It's upside down...
Small doubt, when there is 3 cards left and its my turn and I pick all the three cards. Who wins? As I am taking all the last cards, I lose right? Bot wins?
09:52
@CoolCloud then you lose. Whoever takes the last card loses.
Kay man, I guess this code works, I'll push the changes. Thanks alot
@AndrasDeak that's obviously the most logical solution... I did wonder why there was a Kangaroo in the back garden this morning... :p
@JonClements I remember seeing a video where the worst cases in Australia were shown. Kangaroos, SPIDERS, HIVE OF SPIDERS, bugs. Still terrifies me to this day
Heck, in the UK, if you get a spider in your house - you can pretty much be "meh" about it - it's not going to kill you if it bites you (not even sure most of 'em bite)... in Oz though... I imagine I'd be quite a bit paranoid about it
Wait until it bites :PP
 
1 hour later…
11:12
cbg, which should I prefer in the following?
seq = [(1,), (1, 2), (1, 2, 3)]
print(max(map(len, seq)))
print(len(max(seq, key=len)))
Without taking into account, efficiency or anything. First one looks nice.
the second one does one extra len call as far as I can tell, its not really a huge deal I guess
The first one is much easier to read
ok first one it is, thanks guys
"print the maximum length of an item in seq" vs "print the length of the maximum item in seq ordered by length"
11:24
So both the codes have different outputs?
the first one is what I want to do, I am trying to wrap my head on what Aran meant by the second
No, same output. I just phrased the 2nd one a little poorly
fewer operations = easier to understand. That's all there really is to it
@python_user Throwback to the time, I had computer practical's in school and the invigilator asked difference between list and tuple. I blacked out and said tuple should have more than one item 💀 and when the invigilator said "that's not true", I was like "I think it's true" 💀💀
I just got confused all of sudden between (1) and (1,) back then :p
add 1, to your list for more confusion ;)
@python_user wait, whaat?
11:32
"this_is_a_tuple = 1," is a tuple, you dont need the parenthesis, if you didnt already know
I had someone ask me a similar question, I long assumed that was a syntax error
Ha yes, I do know that. I realized it when I once used return var1,var2 and it came out as tuple and had my head scratching. After researching, realized.
@python_user damn :P
12:26
@python_user it's probably one of the cases where I would use explicit parentheses because the comma is easy to miss
come to think of, I have never done that in actual use case, I have a list of tuples, but never have I had a need to use a 1 tuple literal
I never realized that not implementing __eq__ was a feature until @dataclass came along and now I have to pass eq=False all the time :|
Kinda wish we had id-based dicts in addition to equality-based dicts
exactdict?
Dict3: Arena by id software
13:20
Can anyone to understand the question design here > stackoverflow.com/questions/55065199/…
I have placed there a comment as "how about the case assuming of (A, A) = 0, (B,B) = 0, etc.. because they are not available in any case. For instance in both cases (ID=1 or ID=2), AA is not exist. If we want to figure out counting only those conditions > AB, AC, BA, BC, CA, CB (from ID=1) and BC, CB (from ID=2), how can we modify the merge side ? Thanks"
I would like to count the number of relations very similar to this question but I am assuming there is a mistake. Anyone can help about this ?
I assumed that I have to focus on merge side to handle the proposed scenario. However, I could not handle it really so far :(
my expectation on this question is A B C
A 0 1 1
B 1 0 2
C 1 2 0
13:45
Can I handle it with merge.query() ?
13:55
Can't you just use fill_diagonal afterwards?
fill_diagonal cannot help because there might be cases which modify diagonal values. For instance > ID | Value
1 | A
1 | A
1 | B
1 | C
2 | B
2 | C
2 | C

A B C
A 1 1 1
B 1 0 2
C 1 2 1
I think you'd be better starting a new question rather than hassling people about a modification on something that was asked/answered two years ago. I'm not sure I follow the latest output, either
I am not eligible to ask a question, that is why I tried the chat side.
Having a scan over your questions, it doesn't look like you'd be eligible for a question ban (I'm not a moderator, though). How are you not able to ask?
Even on that question, I do not understand the idea of that part of the question. Do you? Because if I exactly think from the point of who asked the question, there might be a tiny mistake?
I do not know but If I try to ask, it says you are not eligible to ask because of question limit etc.
14:10
But you haven't asked anything since 2020 and your questions aren't all universally downvoted. That seems very strange to me in itself
You have reached your question limit
This is the message once I hit the ask question button.
Weird. I don't know anything about that (sorry for distracting from your question)
No problem at all. You are absolutely right that I should ask it as a new question. As I explained I am not eligible to do. I might mention it at the beginning of my message early on the chat. By the way, thanks a lot for your comments.
It's no problem, though I haven't been very helpful. However, I might now see the logic you're shooting for
@roganjosh Can we @ a mod here so they can look into this "ban"?
@ozturkib Plus have you deleted questions that have been downvoted alot? Could be a reason too. Just undeleted them and try.
14:26
I would prefer not to because it's very unlikely to be without merit. There could, as you say, be a lot of deleted bad questions currently. It's not our quest to be launched; that's between ozturkid and the mod team
Maybe you're looking for something more along the lines of this @ozturkib?
Yea, sure. Good luck. I encountered something similar despite having 600+ rep back then. I asked it on Meta, as expected got alot of downvotes but someone pointed me in the right direction of deleted question. So that fixed it for meh :D
I might delete only a single question in my history. If that question is the case, I can try to figure out it. Other than that, I am sure that I have not deleted any.
Just give it a try. It will be visible down in your all questions(recentlydeleted questions). Try this: stackoverflow.com/users/current?tab=questions
Sorry for that there are 2 questions in Recently Deleted Questions
So I should undo deletion ?
Both of questions are not deleted by myself, they are deleted by the community.
This means I can only hit undelete flag. This is what you are asking ? (probably not)
You don't have to undelete your questions, though deleted questions would still count towards any penalty that has been applied, with zero opportunity for it to be rectified
14:36
Hmmm yes
I need to wait 6 months according to guideline page to be able to ask :)
Thanks a lot for your help @roganjosh @CoolCloud
15:34
Are there any good (emphasis on the good) alternatives to pytesseract for OCR?
google vision api
hmm I'll take a look into it
Try reading this
note that that would be a paid option
if you want good and free, tesseract is close to about as good as it gets
Yeah; thanks!
15:38
What is wrong with pytesseract? I have been using it lately
I have:
Not to mention, I made a hacktool for online type testing apps. Educational purposes only:p
nothing imo, it's great for what it is. it doesnt go out of it's way to guess issues with bad documents
also, theres ways to improve pytesseract output quality.
import random
import copy

h = [[0, 2, 0, 0], [0, 0, 1, 0], [0, 3, 0, 1], [1, 0, 0, 0]]

m = copy.deepcopy(h)
#
for i in m:
for i2 in range(len(i)):
if i[i2] != 0:
i[i2] = 1

print(h)
print(m)
mnk = random.choices(h[1], weights = m[1], k = 1)
print(mnk) How would I get the position of my randomly selected number?
15:41
@ParitoshSingh thx, sure
Paste the code select all and press ctrl + k
Maybe you could use .index() (although that would find the first instance of the number)
Indent the for loops (so you won't get an IndentationError)
    import random
import copy

h = [[0, 2, 0, 0], [0, 0, 1, 0], [0, 3, 0, 1], [1, 0, 0, 0]]

m = copy.deepcopy(h)
#
for i in m:
    for i2 in range(len(i)):
        if i[i2] != 0:
            i[i2] = 1

print(h)
print(m)
mnk = random.choices(h[1], weights = m[1], k = 1)
print(mnk)
What do you expect the output to be?
i expect to choose any number which is in my list and is positve, not 0. I want to have the position as well, and change after that my number.
15:46
Just let it pick random indices instead of random values
how would I change y = random.randint(0, len(x)) for list for list?
random indices
I upgraded to pip 21.1 and got the error:
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /Users/bobhihi/anaconda3/include/python3.8/UNKNOWN
sysconfig: /Users/bobhihi/anaconda3/include/python3.8
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
random_indices = random.choices(range(len(h[1])), weights=m[1], k=1)
@Aran-Fey i get a list [2] as output, but i should get something like (2, 1) or [2][1]
16:00
Well, if that's the output you want, you'll have to rewrite your code quite a bit
valid_indices = [
    (i, j)
    for i, sublist in enumerate(h)
    for j, value in enumerate(sublist)
    if value != 0
]
random_index = random.choice(valid_indices)
16:12
@Aran-Fey                           [[0, 2, 0, 0], [0, 0, 1, 0], [0, 3, 0, 1], [1, 0, 0, 0]]
[[0, 1, 0, 0], [0, 0, 1, 0], [0, 1, 0, 1], [1, 0, 0, 0]]
I got (3, 1) there is a 0, shouldnt I get (3,0) as valid output?
seems it ignores the if value != 0
Sorry, I misread. I'll go back to lurking
16:42
There is no (3, 1) in valid_indices, so I don't know how you got that as output
17:06
@Aran-Fey oh, yes, you are right, how would I get the number of this indices as well?
The number of what?
17:17
of random_index
You mean the index of random_index in valid_indices?
yes, if I get (0, 1) that the random_value = 2 of h
Same as before. Random index instead of random value.
just mean if i know the tupel pos like print(h[0][1]), if random_index = (0, 1)
Ah, I see. Just do i, j = random_index; value = h[i][j]
17:36
@Aran-Fey great, thx
 
4 hours later…
21:34
hi
Very surprisingly, I did manage to get a not so bad score !!
But not enough for winning :(
Well you said the competition was over, right?
They did not initially give out the losing results. I had to request for it.
@AndrasDeak Here is the updated code, according to variable name changes and all and 69 lines
21:56
@CoolCloud ah, so this was your original submission?
@AndrasDeak Yep

« first day (3844 days earlier)      last day (1328 days later) »