Exemplo n.º 1
0
void twolineoutmixed(int pl, Rat *mixed)
{
    int i;
    char s[MAXSTRL];
    int *support;
    int suppsize = 0;


    support = TALLOC( nstrats[pl], int);

    for (i = 0; i < nstrats[pl]; i++)
        if (mixed[i].num != 0)
	    support[suppsize++] = i ;
    colset(suppsize) ;
    for (i = 0; i < suppsize; i++)
        {
        strattomovetuple (support[i], pl);
        movetupletoa(pl, s);
        colpr(s);
        }
    for (i = 0; i < suppsize; i++)
        {
        rattoa(mixed[support[i]], s);
        colpr(s);
        }
   colout();
   free(support);
}
Exemplo n.º 2
0
void nfprint(void)
{
    char s[MAXSTRL];
    int  i, j;
    printf("NF payoffs:\n");
    
    colset(nstrats[2]+1);
    colleft(0);
    colpr("pay1");
    for (j=0; j<nstrats[2]; j++)
	{
	strattomovetuple(j, 2);
	movetupletoa(2, s);    colpr(s);
	}
    colpr("pay2");
    colnl();
    for (i=0; i<nstrats[1]; i++)
	{
	strattomovetuple(i, 1);
	movetupletoa(1, s);    colpr(s);
	/* payoffs player 1 */
	for (j=0; j<nstrats[2]; j++)
	    {
	    rattoa(nfpay[i][j][0], s);        colpr(s);
	    }
	/* payoffs player 2 */
	colpr("");
	for (j=0; j<nstrats[2]; j++)
	    {
	    rattoa(nfpay[i][j][1], s);        colpr(s);
	    }
	colnl();
	}
    colout();
}       /* end of  nfprint()    */
Exemplo n.º 3
0
void outrealplan(int pl, Rat *rplan)
{
    int i;
    char s[MAXSTRL];

    colset(nseqs[pl]) ;
    for (i = 0; i < nseqs[pl]; i++)
        {
        seqtoa(firstmove[pl] + i, pl, s);
        colpr(s);
        }
    for (i = 0; i < nseqs[pl]; i++)
        {
        rattoa(rplan[i], s);
        colpr(s);
        }
   colout();
}
Exemplo n.º 4
0
void compatstrats(int pl)
{
    char s[MAXSTRL];
    Move seq;
    int i,j,nl;
    int **compattable;
    int  *slist;    /* list of strategies   */
    
    T2ALLOC(compattable, nstrats[pl], nseqs[pl], int);
    slist = TALLOC (nstrats[pl], int);
    
    for (seq = firstmove[pl]; seq < firstmove[pl+1]; seq++)
	{
	j = seq - firstmove[pl];
	nl = seqtostratlist(seq, pl, slist);
	for (i=0; i<nl; i++)
	    compattable [slist[i]] [j] = 1;
	}
    
    printf("\nStrategies compatible with sequences for player %d:\n", pl);
    
    colset(nseqs[pl]+1);
    colleft(0);
    colpr("");
    for (seq = firstmove[pl]; seq < firstmove[pl+1]; seq++)
	{
	seqtoa(seq, pl, s);    colpr(s);
	}
    for (i=0; i<nstrats[pl]; i++)
	{
	strattomovetuple(i, pl);
	movetupletoa(pl, s);   colpr(s);
	for (j=0; j<nseqs[pl]; j++)
	    if (compattable[i][j])
		colpr("x");
	    else
		colpr("");
	}
    colout();
    FREE2(compattable, nstrats[pl]);
    free(slist);
}       /* end of  compatstrats(pl)    */
Exemplo n.º 5
0
void colprEquilibrium(Equilibrium eq)
{
    char smp [2*DIG2DEC(MAX_DIGITS) + 4];
    
    int i;
    int n = eq.lcpdim;
    
    Rat *rats = getStrategies(eq);
    
    colpr("P1:");
	for(i = 2; i < eq.nrows + 2; ++i)
	{
		rattoa(rats[i], smp);
		colpr(smp);
	}
	
    colpr("P2:");
    for(; i < n; ++i)
    {
    	rattoa(rats[i], smp);
    	colpr(smp);
    }
}
Exemplo n.º 6
0
void sfprint(void)
{
    char s[MAXSTRL];
    int i, j, k;
    printf("SF payoffs and constraints:\n");
    
    colset(nseqs[2]+2+nisets[1]);
    colleft(0);
    colpr("pay1");
    for (j=0; j<nseqs[2]; j++)
	{
        seqtoa(firstmove[2] + j, 2, s);    colpr(s);
	}
    colnl();
    colpr("pay2");
    for (j=0; j<nseqs[2]; j++)
	colpr(" ");
    colpr("cons1");
    for (k=1; k<=nisets[1]; k++)
	/* headers for constraint matrix pl1, printed on right of payoffs   */
	colpr((firstiset[1]+k-1)->name);
    for (i=0; i<nseqs[1]; i++)
	{
	/* payoffs player 1 */
	seqtoa(firstmove[1] + i, 1, s);    colpr(s);
	for (j=0; j<nseqs[2]; j++)
	    {
	    rattoa(sfpay[i][j][0], s);     colpr(s);
	    }
	colnl();
	/* payoffs player 2 */
	colpr("");
	for (j=0; j<nseqs[2]; j++)
	    {
	    rattoa(sfpay[i][j][1], s);     colpr(s);
	    }
	/* constraints player 1 */
	for (k=0; k<=nisets[1]; k++)
	    colipr(sfconstr[1][k][i]);    
	colnl();
	}
    /* constraints player 2 */
    for (k=0; k<=nisets[2]; k++)
	{
	colnl();
	if (k==0)
	    colpr("cons2");
	else
	    colpr((firstiset[2]+k-1)->name);
	for (j=0; j<nseqs[2]; j++)
	    colipr(sfconstr[2][k][j]);
	colnl();
	}
    colout();
}       /* end of  sfprint()            */
Exemplo n.º 7
0
Arquivo: col.c Projeto: ptigwe/gte
void colipr(int i)
{
    char s[ISTR];
    sprintf(s, "%d", i);
    colpr(s);
}
Exemplo n.º 8
0
Arquivo: col.c Projeto: ptigwe/gte
void colnl(void)
{
    int j;
    for (j=currcol; j < ncols; j++)
         colpr("");
}