Comp Sci Learning Pseudocode: A Crash Course for Beginners

AI Thread Summary
The discussion centers on learning pseudocode, specifically in the context of implementing the minimax algorithm. A user expresses a desire to understand pseudocode better despite having some programming experience, particularly in Python and object-oriented programming. The provided pseudocode is critiqued for inconsistencies, as it incorrectly suggests that a single node is passed while calling for a list of nodes. Participants recommend referring to Wikipedia for a clearer explanation and guidance on implementation. Overall, the conversation highlights the importance of understanding the structure and logic of pseudocode for effective programming.
shivajikobardan
Messages
637
Reaction score
54
Homework Statement
minimax algorithm artificial intelligence
Relevant Equations
algorithm given below
I found pseudocode for this problem below-:

Code:
def minimax(current node):
    if is_leaf(current_node):
        return static_evaluation(current_node)
    if is_min_node(current_node):
        return min(minimax(children_of(current_node)))
    if is_max_node(current_node):
        return max(minimax(children_of(current_node)))
How do I learn to do it? I have no idea. Learning these stuffs would be immensely useful. I have ok programming experience. Learnt about dsa and stuffs but I don't have any notes from that time and don't remember much stuffs. Know basic python. Know oop but like dsa forgot and don't have the notes...What to do?
 
Physics news on Phys.org
shivajikobardan said:
How do I learn to do it?

The explanation on Wikipedia is reasonable, with similar pseduocode (although that toggles a flag for alternating player whereas the code above has that information in the node).
 
pbuk said:
The explanation on Wikipedia is reasonable, with similar pseduocode (although that toggles a flag for alternating player whereas the code above has that information in the node).
any idea how to implement it?
 
shivajikobardan said:
any idea how to implement it?
Follow the explanation accompanying the code. I suggest you use the Wikipedia page I linked, the code you posted (which appears to be Python not pseudocode) is rubbish: the first line says that the function minimax has a single node as its only argument but on lines 5 and 6 it is called with what must be a list of nodes.
 

Similar threads

Replies
15
Views
5K
Replies
4
Views
1K
Replies
15
Views
2K
Replies
7
Views
7K
Replies
10
Views
2K
Replies
2
Views
1K
Replies
3
Views
2K
Back
Top