Commit 6a2ec4d8 by songxinkai

add c++/queue

parent ca1e3418
*core
*a.out
.*.swp
*bin
*bin.finish
......@@ -47,8 +47,8 @@ void read(const string file, vector<vector<float> >& feas,
void write(const string file){
int steps_out = 400;
int winner_out = 1; // 1: black win, 0: white win
unsigned char feas_out[400 * 17*19*19] = {0};
float pis_out[400 * 362] = {0.0};
unsigned char* feas_out = new unsigned char[steps_out * 17*19*19];
float* pis_out = new float[steps_out * 362];
srand((int)time(0));
for (int i = 0; i < steps_out; ++i){
int position_0 = int(361.0 * rand()/(RAND_MAX+1.0));
......@@ -81,14 +81,15 @@ void write(const string file){
int main (){
stringstream ss;
for (int i = 0; i < 1000; ++i){
ss.str("");
ss << "go/" << i << ".bin";
// for (int i = 0; i < 1000; ++i){
// ss.str("");
// ss << "go/" << i << ".bin";
// write(ss.str());
// }
vector<vector<float> > feas;
vector<vector<float> > pis;
vector<float> vs;
read(ss.str(), feas, pis, vs);
read("0.bin", feas, pis, vs);
cout << feas.size() << ", " << pis.size() << ", " << vs.size() << ", " << endl;
for (int i = 0; i < feas.size(); ++i){
cout << "========" << i << "======" << endl;
......@@ -106,7 +107,6 @@ int main (){
}
cout << endl << vs[i] << endl;
}
}
return 0;
}
/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
\ No newline at end of file
#include <queue>
#include <iostream>
#include <string>
#include <thread>
using namespace std;
int main (){
queue<int> q;
cout << "q.empty(): " << q.empty() << endl;
q.push(0);
q.push(1);
q.push(2);
q.push(3);
cout << "q.size(): " << q.size() << endl;
cout << "q.front(): " << q.front() << endl;
cout << "q.size(): " << q.size() << endl;
cout << "q.back(): " << q.back() << endl;
cout << "q.size(): " << q.size() << endl;
q.pop();
cout << "q.size(): " << q.size() << endl;
cout << "q.front(): " << q.front() << endl;
cout << "q.size(): " << q.size() << endl;
cout << "q.back(): " << q.back() << endl;
cout << "q.size(): " << q.size() << endl;
//cout << "q.front(): " << q.pop() << endl;
return 0;
}
......@@ -4,6 +4,12 @@
using namespace std;
int main(){
const int len0 = 3;
int len1 = 3;
int aa[len0] = {1,2,3};
int bb[len1] = {11,22,33};
cout << "aa: " << aa[0] << ", " << aa[1] << ", " << aa[2] << ", " << aa[3] << endl;
cout << "bb: " << bb[0] << ", " << bb[1] << ", " << bb[2] << ", " << bb[3] << endl;
vector<int> a(5,1);
vector<int> b = {1,1,1,1,1};
vector<int> c = {1,1,1};
......
/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment