u/1_Yui

4 post karma · 3,090 comment karma · joined Oct 2013

1_Yui

I think there's an even better example of this trope in Bloodborne. After a certain point in the story, the city starts being infested by giant, horrific creatures called Amygdala clinging to the side of almost all buildings. Later yout find out they were there all along and watching you, you were just not able to perceive them yet up until this point.

1_Yui

Mit KI wenn ich dafür bezahlt werde, von Hand wenns Spaß machen soll oder ich was lernen will.

1_Yui

Use studies. I create a new study for every tournament/league I play in. After a match, create a new chapter in the study and play out the moves in it. Then you can go over it, add annotations and run a computer analysis. Just as an example here's one of my tournament studies: https://lichess.org/study/4eXAnd0f

1_Yui

Finally, someone found a use for all those memory stones

1_Yui

There's a difference between crushing someone and playing a perfect engine game. Even in a crushing game, an honest player makes sub-optimal moves - often because they're more pragmatic and easy to convert than the engine continuation. The odds of someone with your rating making so many top engine moves by chance is incredibly low. Lichess has the data to automatically detect and flag this.

These two factors - an unconventional (but playable) opening to "throw off" cheat detection followed by an unhumanly played game - are a clear indicator that something is strange. I'm just explaining to you how you got caught and will stop responding now, what you do with this information is up to you.

1_Yui

Because you probably did cheat. Take for example your second-to-last game where you played a questionable attacking opening followed by 15 top engine moves: https://lichess.org/tGFJfInI#11

Or your final game where you played another questionable opening followed by 40 perfect moves except 1 minor inaccuracy: https://lichess.org/YtssgHp4/black

Just because you're not cheating on every single move or picking a strange opening intentionally doesn't mean the anti-cheat can't pick up on this extremly obvious pattern.

1_Yui

Yes, the FETCH_RAISE mode looks very interesting for unit tests! And I guess just slapping a FETCH_PEERS on all major queries reduces the chances of accidentally leaving a N+1 query in somewhere but it's not exactly an elegant solution.

1_Yui

I don't really see the point of this except if you don't know in advance what fields are going to be fetched. In all other cases, select_related and prefetch_related are probably still the better choice.

1_Yui

Because game development is a creative endeavor many consider AI to be fundamentally incompatible with. Add to this that many people here want to learn game development and that involves you doing the work yourself.
AI might make sense for people who a) don't have a personal issue with using it and b) have built the experience necessary to judge which parts of their workflows they can delegate and which to do themselves. But that's the minority of people here.

1_Yui

As some mentioned, in most cases naming your functions or variables "_" is bad practice. However, this is a special counterexample. Using "_" as an alias for "gettext" or "gettext_lazy" is common practice in Python programming and vastly improves the readability of code containing localized strings. For example, take a look at Django's documentation on translation: https://docs.djangoproject.com/en/6.0/topics/i18n/translation/

1_Yui

Then Kxf2 is possible

1_Yui

In the middlegame the rule of thumb is that you should usually take towards the center (e.g. bxc6). One reason is like you mentioned that you want to control the center. Additionally, it tends to be safer for your king. (e.g. if you've castled short and your opponent takes something on g6, taking back away from the center with fxg6 opens the diagonal to your king)

In the opening, taking away from the center is actually often better because it allows you to develop the bishop better. However, I think both variations are okay in your example on account of White giving up the bishop pair completely unprovoked.

I would play dxc6 because the development afterwards is more intuitive, but bxc6 with more aggressive plans like Ba6 and Rb8 is also playable.

1_Yui

For some reason it bothered me that March is apparently winter. Not only is it clearly not, but if you follow a season=3 months rule that cascades to June still being spring, September summer and most outrageously to December being an autumn month. I assume they had a lookup table in the assignment which would obviously complicate the formula but luckily I didn't have it. The exception thing is just down to me trying to get as close as possible as I can in just one line, adding a try/except around it adds nothing interesting to the problem. I included the hyphen so that you cannot enter e.g. Day=1J and Month=anuary. But I think we're both overthinking this extremely trivial problem that I just found fun to spend 5 minutes on yesterday. Thanks for the feedback!

1_Yui

Maybe it's unclear because I didn't provide a tutorial for my silly code golf solution so here we go:
1. The month must be a localized month name (e.g. "May" or "March") not just a number
2. Because Python exception handling requires multiple lines this raises a ValueError for invalid entries or dates instead of showing "invalid"
3. Spring is assumed to start in March and each season takes three months but I made that up
4. Because the year is not entered (as the post didn't mention it) leap days are not allowed

1_Yui

That's true, but still the popularity of chess computing has led to a rich ecosystem that lowers the barrier of entry. AI tools can easily rely on existing, well documented open-source solutions for core components like board visualization, game rules and engine evaluation. Because of that it's possible to quickly push out half-baked AI solutions that seem functional with just a few prompts.

1_Yui
print(["Spring","Summer","Autumn","Winter"][(datetime.strptime(f"{input("Day: ")}-{input("Month: ")}","%d-%B").date().month-3)%12//3])
1_Yui

Your comment has actually motivated me to look into the behavior of Django's TextChoices more closely because I also never quite understood how it actually worked.

Django defines a custom metaclass for choice types that takes the tuples you provide in the class definition. It removes the last element of the tuple of each enum member and instead attaches it to the member as a label after the enum has been initialized. The actual code is more complex but it kind of works like this:

enum_member = classdict[member_name] # Gets tuple from the class, e.g. RED = "R", "Red"
classdict[member_name] = enum_member[:-1] # Removes the last element of the tuple
label = enum_member[-1]
... class is initialized here
cls.__members__[member_name].label = label # Adds it as a label instead

So under the hood TextChoices is a StrEnum with a custom metaclass that splits the enum values into the string component and a label. You could copy this approach, here's the file where it's implemented: https://github.com/django/django/blob/stable/5.2.x/django/db/models/enums.py

1_Yui

As u/wildsoup1 has pointed out, that's not how enums work in Python. First you have to define a type that contains x and y, for example:

class MyType:
    def __init__(self, x, y):
        self.x = x
        self.y = y

If the different objects (A, B, ...) are predefined, you can now create an "enum-like" structure: (but take note that it's not actually derived from enum.Enum, because by Python's definition it's not actually an enum, it's just a class with static members)

class MyEnum:
    A = MyType(1, 2)
    B = MyType(13, 4)
print(MyEnum.A.x)

If the objects must be read from the dictionary dynamically at runtime, this approach doesn't make sense, because in your code you wouldn't know that "MyEnum.A" exists yet. Instead, you'd have to parse these objects into a dynamic datastructure that makes sense, and we'd need more information about what you're doing for that. A dictionary is already a fairly sensible option. You could do something like this to convert x and y into the defined type:

objects = {
    name: MyType(**fields)
    for name, fields in input_dict.items()
}
print(objects["A"].x)

assuming input_dict contains a dictionary structured as in your example.

1_Yui

No, you cannot conclude that from this graph. The time you spend on a move is closely related to how difficult to play the current position is - if it's sharp you have to calculate a lot of tactics, if it's slow you can make decent moves more quickly based on a plan or opening that you know. The risk of making a critical mistake is much higher in the first scenario than in the second. Therefore, the conclusion I'd draw is "If I have to think longer about a position, it's probably complicated and mistakes are more likely". I know that's not helpful but it's difficult in general to draw sweeping conclusions about your playstyle solely based on stats and not the specifics of the mistakes you made.

From OTB tournaments I can tell you that the grass is always greener on the other side. If you lose because you spent too much time early, you'll conclude that you should've just been confident in your intuition and made moves more quickly. If you lose because you missed something after moving quickly, you'll conclude that you should take more time and make sure you've fully considered the position before making a move. I'd advise not to fall into this rabbit hole and to continue focusing on improving your skills through study and practice instead.

1_Yui

I find the second half of Dark Souls 1 absolutely terrible. Rushed, boring, unfinished. If any of their modern games released with an area in the state of Lost Izalith today, they would rightfully be shamed into the ground for it. The Duke's Archive & New Londo are passable, but the rest is either clearly unfinished or tedious. I dislike it to the point that I usually stop playing after beating O&S on a new character.

1_Yui

The first approach is much better. If your User model or the form changes, ModelForm's save method handles most of it automatically. In the second version you'd have to update the code manually everytime this happens.

I think the most "Django-like" way to do it would be to move the logic to the clean-method and leave the save-method completely untouched. Generating the username if it's missing is part of the "cleanup" process of the form and not really related to the saving of it.

def clean(self):
    cleaned_data = super().clean()
    username = cleaned_data["username"]
    if not username:
        base = cleaned_data["email"].split("@")[0]
        # Your code to generate the username from the email
        cleaned_data["username"] = generated_username
    return cleaned_data

However, your first version is also okay.

1_Yui

No your experience is pretty normal, even for experienced players that try a new Souls game for the first time. In Elden Ring I was stuck on some bosses or areas for hours, despite having played every game in the series.

1_Yui

You can expect to resupply regular fuel canisters both at certain huts (e.g. Tarnasjö is the first hut NOBO that has a shop) and in towns (e.g. Ammarnäs). I don't know if the system you use requires specific canisters, but the regular screw-ons are available widely.

1_Yui

I was too stupid to realize that the remaining time and ELO was in the images as well and did the whole thing just based on position+eval...

1_Yui

Yes but nothing wrong with that. My only question is how you got 44 levels just in Lothric castle, doesn't the farming get tedious?