command intercepts (constant thecolor)
{let thepoint getpoint();
let xcoor thepoint(1);
let ycoor thepoint(2);
line Õxcoor,0å thepoint width 1 color thecolor;
line Õ0,ycoorå thepoint width 1 color thecolor;
}

command horizontal (constant thecolor) (constant xstart) (constant xlimit) (constant wide)
{let level getpoint();
let yvalue level(2);
line Õxstart,yvalueå, Õxlimit,yvalueå width wide  color thecolor;
}

command vertical (constant thecolor)
{let level getpoint();
let xvalue level(1);
line Õxvalue, 0å, Õxvalue,9.5å width 1 color thecolor;
}

command decreasedemand (constant domainvar)
{
let it roots(demand(x), 100, Õ-20, 300å);
let xint_demand it(1);
graphdomain domainvar xint_demand-domainvar;
graph demand color grey width 2;
let dsh dsh-5;
let it roots(demand(x), 100, Õ-20, 300å);
let xint_demand it(1);
graphdomain domainvar xint_demand-domainvar;
graph demand color demcol width 2;
pencolor black;
cleartext window "price";
print "This decreases demand, or shifts demand back.";
}

command increasedemand (constant domainvar)
{
let it roots(demand(x), 100, Õ-20, 300å);
let xint_demand it(1);
graphdomain domainvar xint_demand-domainvar;
graph demand color grey width 2;
let dsh dsh+5;
let it roots(demand(x), 100, Õ-20, 300å);
let xint_demand it(1);
graphdomain domainvar xint_demand-domainvar;
graph demand color demcol width 2;
pencolor black;
cleartext window "price";
print "This increases demand, or shifts demand out.";
}

command demand_p_q (constant any)
{
select "price";
cleartext;
print "Click on a point on the demand curve.";
let pt getpoint();
let xvalue truncate(pt(1));
let yvalue demand(xvalue);
select "price";
cleartext;
print "When the price is $";
printon yvalue;
printon ", consumers would like to purchase ";
printon xvalue;
printon "pizzas.";
select "scroll";
point Õxvalue,demand(xvalue)å color red width 6;
line Õxvalue,demand(xvalue)å Õxvalue,0å color red width 1;
line Õxvalue,demand(xvalue)å Õ0,demand(xvalue)å color red width 1;
pencolor black; 'This makes sure the labels remain black'
penwidth 2;
}

command supply_p_q (constant any)
{
select "price";
cleartext;
print "Click on a point on the supply curve.";
let pt getpoint();
let xvalue truncate(pt(1));
let yvalue supply(xvalue);
select "price";
cleartext;
print "When the price is $";
printon yvalue;
printon ", producers are willing to supply ";
printon xvalue;
printon "pizzas.";
select "scroll";
point Õxvalue,supply(xvalue)å color red width 6;
line Õxvalue,supply(xvalue)å Õxvalue,0å color red width 1;
line Õxvalue,supply(xvalue)å Õ0,supply(xvalue)å color red width 1;
pencolor black; 'This makes sure the labels remain black'
penwidth 2;
}

command equilibrium (constant any)
{
select "price";
cleartext;
let xvalue (dsh+ssh)/(ssl+dsl);
let yvalue supply(xvalue);
point Õxvalue,yvalueå color red width 6;
line Õxvalue,yvalueå Õxvalue,0å color red width 1;
line Õxvalue,yvalueå Õ0,yvalueå color red width 1;
pencolor black;
print "At the point of equilibrium, the price is";
print "$";
printon yvalue;
printon ".  At this price, ";
printon truncate(xvalue);
printon "pizzas are demanded and ";
printon truncate(xvalue);
printon "pizzas are supplied.";
pencolor black;
}

