title: Alpha-beta pruning for Minimax
body: <p>I have spent a whole day trying to implement minimax without really understanding it. Now, , I think I understand how minimax works, but not alpha-beta pruning. </p>
  
  <p>This is my understanding of minimax:</p>
  
  <ol>
  <li><p>Generate a list of all possible moves, up until the depth limit.</p></li>
  <li><p>Evaluate how favorable a game field is for every node on the bottom.</p></li>
  <li><p>For every node, (starting from the bottom), the score of that node is the highest score of it's children if the layer is max. If the layer is min, the score of that node is the lowest score of it's children.</p></li>
  <li><p>Perform the move that has the highest score if you are trying to max it, or the lowest if you want the min score.</p></li>
  </ol>
  
  <p>My understanding of alpha-beta pruning is that, if the parent layer is min and your node has a higher score than the minimum score, then you can prune it since it will not affect the result.</p>
  
  <p>However, what I don't understand is, if you can work out the score of a node, you will need to know the score of all nodes on a layer lower than the node (in my understanding of minimax). Which means that you'llstill be using the same amount of CPU power.</p>
  
  <p>Could anyone please point out what I am getting wrong? This answer ( <a href="https://stackoverflow.com/questions/3956258/minimax-explained-for-an-idiot/3956356#3956356">Minimax explained for an idiot</a> ) helped me understand minimax, but I don't get how alpha beta pruning would help. </p>
  
  <p>Thank you.</p>