The Dink Network

Reply to Re: PyDink player demonstration

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
February 13th 2013, 05:31 AM
goblins.gif
I'm going to be thinking a bit on how goto statements could be converted systematically. I've already come up with a basic idea, but it only works if the goto and the loop start are done a specific way. I think that it is possible, but it will be tough since gotos can even jump from function to function. But I'll give it a try anyways. You should continue working on the more important things; I'll look into the goto problem and see if I can help you once you get to the stage of development where you can focus on this kind of stuff.

In case you are wondering, this is the basic idea I came up with, that isn't very comprehensive at all; I'm going to try and expand upon it to make it more useful:

loop:

choice_start();
"Yes"
"No"
choice_end();

if (&result == 1)
{
	say_stop("You said yes", 1);
}
else
{
	say_stop("You can't continue till you say yes!", 1);
	goto loop;
}


could be rewritten as:

do
{
	//add this to the beginning of every goto conversion
	&success = 1;

	choice_start();
	"Yes"
	"No"
	choice_end();

	if (&result == 1)
	{
		say_stop("You said yes", 1);
	}
	else
	{
		say_stop("You can't continue till you say yes!", 1);
		//goto loop;
		//replace goto loop with a failure, causing a restart
		&success = 0
	}
}
until (&success == 1)