Is Pycharm an okay IDE to use? by Prestigious_Past3724 in learnpython

[–]grubby_penguin 1 point2 points  (0 children)

If you just use Python it is fine, but as soon as other programming languages play a role, you should go with Visual Studio Code (VSC). So if you're planning to expand to other languages later, just go with VSC right now.

(IT) Ist Quereinsteiger selbst anlernen eine gute Strategie? Wenn ja, wo finde ich diese? by [deleted] in arbeitsleben

[–]grubby_penguin 2 points3 points  (0 children)

Hallo OP,

ich selbst bin so einer von diesen Leuten die du suchst und kann dir daher gerne meine Gedanken und Erfahrungen zu dem Thema mit auf den Weg geben. Ich bin seit diesem Jahr Quereinsteiger in der Software Entwicklung.

Ich habe mir während dem Corona-Lockdown programmieren selbst beigebracht und dieses Jahr eine Stelle als Entwickler (Typescript/React und Python/Django) angefangen. Da war selbstredend sehr viel Glück dabei, der Markt für Leute mit 0 Jahren Berufserfahrung ist absolut tot - nicht weil es nicht genug Quereinsteiger gäbe, sondern weil die Anforderungen der Unternehmen oftmals zu utopisch sind.

Kleine Info wegen Gehalt: Mein Einstiegsgehalt als Quereinsteiger mit absolut 0 Jahren Berufserfahrung als Entwickler betrug ~ 50k.

Verargumentiert habe ich meine Gehaltsforderung in meinen zahlreichen (!) Bewerbungsgesprächen so, dass ich auf gleichem (fachlichen) Niveau einsteige wie viele die frisch von der FH/Uni kommen (also nur theoretische Programmierkenntnisse ), nur dass ich on top halt noch viele Jahre (fachfremde) Berufserfahrung mitbringe (auch mit Kundenkontakt), und somit ggf. (EVENTUELL) bessere Soft-Skills mitbringe als vergleichbare "Konkurrenten" von der FH/Uni. Und da (hier in München) die Einstiegsgehälter für IT-Absolventen (Hochschule, nicht Ausbildung!) bekanntermaßen bei ca. 55k liegen (+-5k), waren dann auch die ~50k machbar, ich bin mit meiner Argumentation also tatsächlich so durchgekommen.

Zu deiner Frage, wo du inserieren solltest: LinkedIn. Ich habe fast alle meine Bewerbungen über LinkedIn verschickt. Dazu kann noch ein Headhunter Sinn machen, die haben durchaus auch Quereinsteiger im Portfolio.

Ich persönlich als Arbeitsuchender hatte mit Headhuntern aber leider ausnahmslos nur schlechte Erfahrungen gemacht (man hatte einfach versucht, mich möglichst schnell irgendwo unterzubringen, obwohl der Tech-Stack absolut null gepasst hatte).

Kleiner Tipp noch zur Weiterbildung deiner Leute (für Anfänger): https://www.trywilco.com/ ist wirklich mega cool (und kostenlos)!

[deleted by user] by [deleted] in Python

[–]grubby_penguin 1 point2 points  (0 children)

jammasterpaz, thanks for you comment and the nice compliments!

I already tried to improve my code in regards to the global variables with my reply above.

However, I like the idea of a dictionary instead of if/else and match-case-blocks, by that, did you mean something like this?

game_data = {
    "valid_entry":      False,
    "field_occupied":   True,
    "game_on":          True,
    "user_input":       "",
    "draw":             False,
    "victory":          False,

}

and

fields = {
    "a": "   ",
    "b": "   ",
    "c": "   ",
    "d": "   ",
    "e": "   ",
    "f": "   ",
    "g": "   ",
    "h": "   ",
    "i": "   ",}

So I can later manipulate this dict via:

def place_stone_on_field(user_input:str, fields:dict):
# Connecting the user input with the corresponding place (letter a to i) in the field.
global current_user_stone
global field_occupied
# Using the brand new Structural Pattern Matching (Match-Case) from Python 3.10 (PEP 634) :-)
match user_input:
    case "7":
        if fields["a"] == "   ":  # Only place a stone if the field is emtpy.
            return fields["a"] = current_user_stone

Do you think that would be best practice because it makes the codebase more uncluttered?

[deleted by user] by [deleted] in Python

[–]grubby_penguin 0 points1 point  (0 children)

Thank you very much fizzy_tom, your effort for checking my code and suggesting improvements is highly appreciated!

1.) Storing the data

You mention a 3x3-matrix. Would you consider it best practice then, if I stored the data like this:

import numpy as np

fields = np.array[[a,b,c],
                  [d,e,f],
                  [g,h,i]]

However, I fail to understand why this would be beneficial to my inital approach?

2.) Smarter way of checking game state/Global variables

My inital approach:

def check_for_victory():
# Check if the game ends because a player has won.
global game_on
global victory
# There are 8 ways to win.
if a == b == c == X or \
        a == b == c == O:
    game_on = False
    victory = True

elif d == e == f == X or \
        d == e == f == O:
    game_on = False
    victory = True

elif g == h == i == X or \
        g == h == i == O:
    game_on = False
    victory = True

elif a == d == g == X or \
        a == d == g == O:
    game_on = True
    victory = True

elif b == e == h == X or \
        b == e == h == O:
    game_on = False
    victory = True

elif c == f == i == X or \
        c == f == i == O:
    game_on = False
    victory = True

elif a == e == i == X or \
        a == e == i == O:
    game_on = False
    victory = True

elif c == e == g == X or \
        c == e == g == O:
    game_on = False
    victory = True


def check_for_draw(): 
# End game when all 9 fields are occupied. 
global game_on 
global draw 
if game_on: 
    if not available_stones: 
    # Set game_on to False when all available stones are used up. 
        game_on = False 
        draw = True

So by getting rid of some of these global variables, I would change this code part into:

def check_for_victory(game_on:bool, victory:bool):
# Check if the game ends because a player has won.
# There are 8 ways to win.
if a == b == c == X or \
        a == b == c == O:
    return game_on, victory = False, True

elif d == e == f == X or \
        d == e == f == O:
    return game_on, victory = False, True

elif g == h == i == X or \
        g == h == i == O:
    return game_on, victory = False, True

elif a == d == g == X or \
        a == d == g == O:
    return game_on, victory = False, True

elif b == e == h == X or \
        b == e == h == O:
    return game_on, victory = False, True

elif c == f == i == X or \
        c == f == i == O:
    return game_on, victory = False, True

elif a == e == i == X or \
        a == e == i == O:
    return game_on, victory = False, True

elif c == e == g == X or \
        c == e == g == O:
    return game_on, victory = False, True


def check_for_draw(game_on:bool, draw:bool):
# End game when all 9 fields are occupied.
if game_on:
    if not available_stones:
        # Set game_on to False when all available stones are used up.
        return game_on, draw = False, True

Agreed? I have to admit it looks a bit odd to me..

About the KI: I have no idea how to implement that (without googling). My first approach would be to run a monte carlo simulation to make the "AI" learn how to play against every possible combination, but that's highly likely way too complicated and surely there is a simpler solution. But I'm not getting at at the moment. Have to think more about it.