Sovereignty

Donald, I need your help with this programming class. It uses a new programming language, D++, which is exactly the grade I’m going to get if I don’t figure this out.

// assign values to piles
{
    Set.PileName(00) = A
    Set.PileName(01) = B
    Set.PileName(02) = C
    Set.PileName(03) = D
    Set.PileName(04) = E
    Set.PileName(05) = F
    Set.PileName(06) = G
    Set.PileName(07) = H
    Set.PileName(08) = I
    Set.PileName(09) = J
    Set.PileName(10) = K
    Set.PileName(11) = L
    Set.PileName(12) = M
    Set.PileName(20) = N
    Set.PileName(21) = O
    Set.PileName(22) = P
    Set.PileName(30) = Q
}

// start player 1
{
    |PPPMM|,(%P,%P,%P),[@O],,[&]
    |PPPPM|,(%P,%P,%P,%P),[@I],[Sh],[&]
    |PPOMI|,(%I,[tM])(%P,%P,%O),[@I],,[&]
    |PPPPM|,(%P,%P,%P,%P),[@O],[Sh],[&]
    |PPPMM|,(%P,%P,%P),[@O],,[&]
    |PPPOI|,(%I,[tP])(%P,%P,%O),[@O],[Sh],[&]
    |PPPOI|,(%P,%P,%P,%O),[@C],,[&]
    |OOMMI|,(%I,[tM])(%O,%O),[@O],,[&]
    |PPOOO|,(%O,%O,%O),[@G],[Sh],[&]
    |POOCG|,(%G)(%C)(%O,%O,%O),[@G][@D],,[&]
    |POOOI|,(%I,[tP])(%O,%O,%O),[@G],,[&]
    |PPOOM|,(%P,%P,%O,%O),[@N],,[&]
    |PPOOI|,(%I,[tP])(%P,%O,%O),[@C],[Sh],[&]
    |POOGI|,(%G)(%I,[tQ])(%O,%O,%P),[@C][@D],,[&]
    |POOMC|,(%C)(%P,%P,%O,%O),[@C],,[&]
    |POOOI|,(%I,[tP])(%O,%O,%O),[@L],,[&]
    |OOQGG|,(%G)(%G)(%D)(%C)(%O,%O,%O,%O,%P),[@K][@L],[Sh],[&]
    |OOONL|,(%O,%O,%O,%N),[@K],,[&]
    |OMKGI|,(%G)(%C)(%O,%O,%O),[@K],,[&]
    |POCDG|,(%D,[^])(%C)(%G)(%O,%O,%O,%O,%O,%P),[@K][@L],,[&]
}

// start player 2
{
    |PPPMM|,(%P,%P,%P),[@O],,[&]
    |PPPPM|,(%P,%P,%P,%P),[@I],[Sh],[&]
    |PPPOM|,(%P,%P,%P,%O),[@H],,[&]
    |PPPMI|,(%I,[tM])(%P,%P,%P),[@D],[Sh],[&]
    |PPPOM|,(%P,%P,%P,%O),[@C],,[&]
    |PPOMH|,(%H,[p1?I])(%P,%P,%P,%P,%O,%O),[@N],[Sh],[&]
    |PPPCD|,(%C)(%D,[^])(%P,%P,%P,%P,%O),[@N],,[&]
    |POONM|,(%N,%O,%O),[@G],,[&]
    |PPMHI|,(%H,[p3?I])(%P,%P,%N),[@C],,[&]
    |PPONG|,(%G)(%N,%O,%O),[@G][@O],,[&]
    |PPPMD|,(%D,[Sh],[^])(%P,%P,%P,%P),[@M],,[&]
    |PPONI|,(%I,[tP])(%P,%O,%N),[@L],,[&]
    |OOCGH|,(%C)(%G)(%G)(%H,[p1?I])(%O,%O,%O,%N),[@G][@C][@D],[Sh],[&]
    |PPOLC|,(%C)(%P,%P,%O),[@O],,[&]
    |PMQDH|,(%D,[^])(%H,[p3?I],[p1?I])(%P,%P,%N),[@L],,[&]
    |PONCG|,(%C)(%G)(%G)(%C)(%N,%O,%O,%O,%P,%P),[@K][@L][@D],[Sh],[&]
    |KQDGI|,(%D)(%G)(%H)(%O,%O),[@L],,[&]
    |POOMQ|,(%P,%O,%O),[@L],,[&]
    |PMLCG|,(%C)(%C)(%G)(%D)(%N,%N,%P,%P,%P),[@K][@L],,[&]
}

// start player 3
{
    |PPPPM|,(%P,%P,%P,%P),[@E],,[&]
    |PPPMM|,(%P,%P,%P),[@O],[Sh],[&]
    |PPOMM|,(%P,%P,%O),[@E],,[&]
    |PPPPE|,(%E,[tP])(%P,%P,%P),[@N],[Sh],[&]
    |PPOMM|,(%P,%P,%O),[@I],,[&]
    |PPNME|,(%E,[tP])(%N),[@G],[Sh],[&]
    |PPNMM|,(%P,%P,%N),[@C],,[&]
    |POMEE|,(%E,[tP])(%O),[@A],,[&]
    |PPPGI|,(%G)(%E,[tP])(%P,%P),[@N],,[&]
    |PNMAC|,(%C)(%A,[p3*P],[p3*M],[p3*Q],[p3*O])(%N),[@G],[Sh],[&]
    |PONAE|,(%A,[p3*O],[p3*N],[p3*I],[p3*M])(%N,%O),[@G],,[&]
    |PQQCE|,(%C)(%E,[tP]),[@O],,[&]
    |POMGG|,(%G)(%G,[Sh])(%O,%P),[@C][@D],,[&]
    |POMQC|,(%C)(%P,%O),[@M],,[&]
    |OQAEI|,(%A,[p3*P],[p3*O],[p3*N],[p3*E])(%O),[@N],[Sh],[&]
    |NMEGG|,(%G)(%G)(%E,[tP])(%N),[@K][@M],,[&]
    |OMQQC|,(%C)(%O,%P),[@M][@M],,[&]
    |POONN|,(%N,%N,%O,%O),[@K],,[&]
    |OOQDI|,(%D,[^])(%C)(%G,[Sh])(%A,[p3*N],[p3*Q],[p3*O],[p3*E])(%I,[tE])(%O,%O),[@K][@M],,[&]
}

// start player 4
{
    |PPMMM|,(%P,%P),[@D],,[&]
    |PPPPP|,(%P,%P,%P,%P,%P),[@J],[Sh],[&]
    |PPPMD|,(%D,[^])(%P,%P,%P,%P),[@E],,[&]
    |PPPMJ|,(%J,[p1*O],[p2*D],[p3*E])(%P,%P,%P),[@B],[Sh],[&]
    |PPOMJ|,(%J,[p1*O],[p2*I],[p3*P])(%P,%P,%O),[@N],,[&]
    |PMDDE|,(%D,[^])(%D,[^])(%B,[p1?I])(%P,%P),[@D],[Sh],[&]
    |PPPOM|,(%P,%P,%P,%O),[@F],,[&]
    |PDDEI|,(%D)(%D)(%J,[p1*P],[p2Sh],[p2*O],[p3Sh],[p3*E],[p3?I])(%P),[@M],,[&]
    |PPONB|,(%B)(%P,%O,%N),[@N],[Sh],[&]
    |OMMEE|,(%O),[@D],,[&]
    |PPNNM|,(%N,%N,%P,%P),[@K],,[&]
    |PPDDI|,(%D)(%D)(%F)(%I,[tP])(%P,%O),[@L],,[&]
    |OMBDJ|,(%D)(%B,[p1?I])(%P,%P,%P,%O),[@C],[Sh],[&]
    |PPKLI|,(%I,[tP]),,,[&]
    |ONMDF|,(%D)(%F)(%O,%O,%N),[@K][@P],,[&]
    |NMQCD|,(%C)(%D,[^])(%J,[p1*N],[p2*P],[p2?I],[p3*M])(%N,%P,%P),[@K],,[&]
    |PPMDE|,(%D,[^])(%E,[tP])(%O),[@L],[Sh],[&]
    |MBDEI|,(%D,[^])(%D)(%I,[tB])(%O),[@M],,[&]
    |PMMMK|,,,,[&]
}

// remember nlen() ignores whitespace!
{
Output=[
	A.nlen()+F.nlen()-K.nlen()-O.nlen(),
	E.nlen()+H.nlen()+I.nlen()-Q.nlen(),
	D.nlen()+E.nlen()+G.nlen()-M.nlen(),
	A.nlen()+J.nlen()-K.nlen(),
	A.nlen()+B.nlen()+G.nlen()-L.nlen(),
	C.nlen()+F.nlen()+H.nlen()-Q.nlen(),
	D.nlen()+I.nlen()-M.nlen()-P.nlen(),
	A.nlen()+D.nlen()+F.nlen()-L.nlen(),
	C.nlen()+G.nlen()+I.nlen()-P.nlen(),
	A.nlen()+E.nlen()+J.nlen()-O.nlen(),
	D.nlen()+F.nlen()+H.nlen()-N.nlen(),
	D.nlen()+E.nlen()-O.nlen(),
	B.nlen()+I.nlen()+J.nlen()-L.nlen(),
	H.nlen()+I.nlen()+J.nlen()-L.nlen(),
	A.nlen()+C.nlen()+J.nlen()-O.nlen(),
	B.nlen()+F.nlen()-Q.nlen(),
	B.nlen()+E.nlen()-L.nlen()-M.nlen(),
	G.nlen()+H.nlen()-M.nlen()-P.nlen()
	]
}
Sheila Sunshine
Sheila Sunshine