I am having some troubles with my code. I programmed it how I know and what my professor told me but my code won't execute. I went into the code with the debugger and it just keeps looping on the MyWorld class and I don't know if I did something wrong or not. Help would be appreciated, Thanks.
import greenfoot.*;
public class MyWorld extends World
{
public MyWorld()
{
super(600, 400, 1);
}
public void act(int heads, int tails, int num)
{
num = Greenfoot.getRandomNumber(1);
if (num == 1)
{
heads++;
}
else
{
if(num == 0)
{
tails++;
}
}
while ( heads + tails != 50 )
{
num = Greenfoot.getRandomNumber(1);
}
showText("Number Of Heads "+heads, 300, 200);
showText("Number Of Tails "+tails, 300, 190);
}
}

