Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mytests
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songxinkai
mytests
Commits
ca1e3418
Commit
ca1e3418
authored
Jan 10, 2019
by
songxinkai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
20190110, modify go_data_write_example 2
parent
89b3b291
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
c++file/binary_read_write/a.out
+0
-0
c++file/binary_read_write/main.cpp
+25
-25
No files found.
c++file/binary_read_write/a.out
View file @
ca1e3418
No preview for this file type
c++file/binary_read_write/main.cpp
View file @
ca1e3418
...
@@ -14,13 +14,13 @@ using namespace std;
...
@@ -14,13 +14,13 @@ using namespace std;
void
read
(
const
string
file
,
vector
<
vector
<
float
>
>&
feas
,
void
read
(
const
string
file
,
vector
<
vector
<
float
>
>&
feas
,
vector
<
vector
<
float
>
>&
pis
,
vector
<
float
>&
vs
){
vector
<
vector
<
float
>
>&
pis
,
vector
<
float
>&
vs
){
int
steps_in
=
0
;
int
steps_in
=
0
;
float
winner_in
=
0.
0
;
int
winner_in
=
0
;
char
feas_in
[
1000
*
17
*
19
*
19
];
char
feas_in
[
1000
*
17
*
19
*
19
];
float
pis_in
[
1000
*
362
];
float
pis_in
[
1000
*
362
];
std
::
ifstream
input
(
file
,
ios
::
in
|
ios
::
binary
);
std
::
ifstream
input
(
file
,
ios
::
in
|
ios
::
binary
);
input
.
read
((
char
*
)
&
steps_in
,
sizeof
(
int
));
input
.
read
((
char
*
)
&
steps_in
,
sizeof
(
int
));
// CHECK_LE(steps_in, 1000);
// CHECK_LE(steps_in, 1000);
input
.
read
((
char
*
)
&
winner_in
,
sizeof
(
floa
t
));
input
.
read
((
char
*
)
&
winner_in
,
sizeof
(
in
t
));
input
.
read
((
char
*
)
feas_in
,
sizeof
(
char
)
*
19
*
19
*
17
*
steps_in
);
input
.
read
((
char
*
)
feas_in
,
sizeof
(
char
)
*
19
*
19
*
17
*
steps_in
);
input
.
read
((
char
*
)
pis_in
,
sizeof
(
float
)
*
(
19
*
19
+
1
)
*
steps_in
);
input
.
read
((
char
*
)
pis_in
,
sizeof
(
float
)
*
(
19
*
19
+
1
)
*
steps_in
);
input
.
close
();
input
.
close
();
...
@@ -36,7 +36,7 @@ void read(const string file, vector<vector<float> >& feas,
...
@@ -36,7 +36,7 @@ void read(const string file, vector<vector<float> >& feas,
for
(
int
j
=
0
;
j
<
1
+
19
*
19
;
++
j
){
for
(
int
j
=
0
;
j
<
1
+
19
*
19
;
++
j
){
pis
[
step
][
j
]
=
pis_in
[
step
*
(
1
+
19
*
19
)
+
j
];
pis
[
step
][
j
]
=
pis_in
[
step
*
(
1
+
19
*
19
)
+
j
];
}
}
if
((
step
%
2
==
0
)
^
(
winner_in
==
1
.0
)){
// self lose
if
((
step
%
2
==
0
)
^
(
winner_in
==
1
)){
// self lose
vs
[
step
]
=
-
1.0
;
vs
[
step
]
=
-
1.0
;
}
else
{
}
else
{
vs
[
step
]
=
1.0
;
vs
[
step
]
=
1.0
;
...
@@ -84,28 +84,28 @@ int main (){
...
@@ -84,28 +84,28 @@ int main (){
for
(
int
i
=
0
;
i
<
1000
;
++
i
){
for
(
int
i
=
0
;
i
<
1000
;
++
i
){
ss
.
str
(
""
);
ss
.
str
(
""
);
ss
<<
"go/"
<<
i
<<
".bin"
;
ss
<<
"go/"
<<
i
<<
".bin"
;
write
(
ss
.
str
());
//
write(ss.str());
//
vector<vector<float> > feas;
vector
<
vector
<
float
>
>
feas
;
//
vector<vector<float> > pis;
vector
<
vector
<
float
>
>
pis
;
//
vector<float> vs;
vector
<
float
>
vs
;
//
read(ss.str(), feas, pis, vs);
read
(
ss
.
str
(),
feas
,
pis
,
vs
);
//
cout << feas.size() << ", " << pis.size() << ", " << vs.size() << ", " << endl;
cout
<<
feas
.
size
()
<<
", "
<<
pis
.
size
()
<<
", "
<<
vs
.
size
()
<<
", "
<<
endl
;
//
for (int i = 0; i < feas.size(); ++i){
for
(
int
i
=
0
;
i
<
feas
.
size
();
++
i
){
//
cout << "========" << i << "======" << endl;
cout
<<
"========"
<<
i
<<
"======"
<<
endl
;
//
for (int j = 0; j < 19*19; ++j){
for
(
int
j
=
0
;
j
<
19
*
19
;
++
j
){
//
cout << j << ": ";
cout
<<
j
<<
": "
;
//
for (int c = 0; c < 17; ++c){
for
(
int
c
=
0
;
c
<
17
;
++
c
){
//
cout << feas[i][j*17+c] << ", ";
cout
<<
feas
[
i
][
j
*
17
+
c
]
<<
", "
;
//
}
}
//
cout << endl;
cout
<<
endl
;
//
}
}
//
for (int j = 0; j < pis[i].size(); ++j){
for
(
int
j
=
0
;
j
<
pis
[
i
].
size
();
++
j
){
//
if (pis[i][j] != 0){
if
(
pis
[
i
][
j
]
!=
0
){
//
cout << "(" << j << "-" << pis[i][j] << "), ";
cout
<<
"("
<<
j
<<
"-"
<<
pis
[
i
][
j
]
<<
"), "
;
//
}
}
//
}
}
//
cout << endl << vs[i] << endl;
cout
<<
endl
<<
vs
[
i
]
<<
endl
;
//
}
}
}
}
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment