this is a part of my graduation project on Minority Game,
I have problem with changing
MemValues after first it iteration,
at the first iteration I need random values,
but after that i will have 1 Last win wihch would be the temp[m_nMemory-1] and then eache value should be shift to left and the first node should be deleted..
I Try mane ways ,
but this part:
while(temp2->nxt!=NULL)
{
temp2=temp2->nxt;
}
temp2->nxt=temp[mem];
}
wont work when I debug the program..
Help me please:(
for(it=0;it<m_nIteration;it++)
{
sum=0;
Zero=0;
One=0;
NewHist=0;
itoa(satr,r,10);
m_list.InsertItem(satr++,r,0);
temp1=start_ptr;
for(mem=0;mem<m_nMemory;mem++)
{
temp[mem]=new node;
p=(m_nMemory-mem)-1;
if(it==0)
{
temp[mem]->MemValue=GenerateRand(0,2);
temp[mem]->nxt=NULL;
NewHist=NewHist+temp[mem]->MemValue*pow(2,p);
memstr=temp[mem]->MemValue;
memstr1=itoa(memstr,r,10);
m_list.SetItemText(it,mem+1,memstr1);
strText=itoa(NewHist,r,10);
m_list.SetItemText(it,m_nAgent+m_nMemory+1,strText);
if(temp1==NULL)
start_ptr=temp[mem];
else
{
temp2=start_ptr;
while(temp2->nxt!=NULL)
{
temp2=temp2->nxt;
}
temp2->nxt=temp[mem];
}
}
}
}