D6 dice pool from 0 to 6 where resolving 0 is rolling 2 dice and counting the lower result only. Rolling 5 or 6 means a hit. Rolling 1 is a mishap. Degrees of Success:

 - Failure: no hits at all  
 - Mixed Success: only 1 hit 
 - Basic Success: at least 2 hits
 - Critical Success: at least 2 dice showing "6" 
 
For this time rolling more than 2 hits will not count so no need to show that on anydice.  

Now the players can take a risk and push the roll, rerolling all the dice that are not "1" or "hit" (5-6). The requirement is to have at least 1 hit in the initial roll. After the reroll, hits may increase for a better overall result; or if they scored no hits with the reroll, they lose a hit from the initial roll which can make the overall result worse. I need to see that just like in games like Vaesen where a chart shows the chance of success scaling with the number of dice but also the chance when pushing the roll.  

I tried to do something but couldn't do well unfortunately.

<pre><code>
function: push ROLL:s {
 H:0 \number of hits\
 C:0 \number of crits\
 loop X over {1..#ROLL} {
  if X@ROLL>4 {H:H+1 if X@ROLL=6 {C:C+1}}
 }
 result: C*10+H \to send both crit and hit numbers?\
}

function: make ROLL:s TBP:n {
 H:0 \number of hits\
 B:0 \number of blanks\
 C:0 \number of crits\
 loop X over {1..#ROLL} {
  if X@ROLL>4 {H:H+1 if X@ROLL=6 {C:C+1}}
  else if X@ROLL>1 {B:B+1}
 }
 if TBP=1 {
  T:[push Bd6]
  C:C+(T/10)
  H:H+(T-((T/10)*10))
 }
 
 if H>2 {H:2}
 if C>1 {result:3}
 else {result:H}
}
</code></pre>
Then when I try to output it introduces this error;  
### Calculation error ###
Boolean values can only be numbers, but you provided "d{0..0}".
Depending on what you want, you might need to create a function.  

Any help would be appreciated. I feel like there is a better way but I can't see it apparently.  

EDIT::
<pre><code>
function: make ROLL:s TBP:n HT:n BL:n CR:n {
 H:HT\H number of hits\
 B:BL\B number of blanks\
 C:CR\C number of crits\
 loop X over {1..#ROLL} {
  if X@ROLL>4 {H:H+1 if X@ROLL=6 {C:C+1}}
  else if X@ROLL>1 {B:B+1}
 }
 if H=HT {H:H-1 if C>1 {C:C-1}}
 if H<0 {H:0}
 if H>2 {if C>1 {H:3} else {H:2}}
 
 if H>0 & TBP=1 {result:[make Bd6 0 H B C]}
 else {result:H}
}

loop C over {1..6} {
  output [make Cd6 1 0 0 0] named "[C]d"
}
</code></pre>

I've tried this and it's been compiled at least, but not sure if I can confirm it mathematically. And still is there a better way?