ETrobocon2017 - 片山研究所モデルベース開発推進事業部
str
apps
explorer
BoardAnalyzer.cpp
[詳解]
1
#include "
BoardAnalyzer.h
"
2
3
BoardAnalyzer::BoardAnalyzer
()
4
{
5
6
}
7
8
BoardAnalyzer::~BoardAnalyzer
()
9
{
10
11
}
12
13
// ubN̔zu̓ void BoardAnalyzer::set(int* initPositions) { positions = initPositions; } // lp`̃ubŇ int BoardAnalyzer::getInLeftSquareCount() { int leftSquareCount = 0; for(int i=0; i<5; i++) { for(int j=0; j<5; j++) { if(positions[i] == leftSquare[j]) { leftSquareCount++; } } } return leftSquareCount; }
14
void
BoardAnalyzer::set
(
int
* initPositions)
15
{
16
positions = initPositions;
17
}
18
19
// lp`̃ubŇ
20
int
BoardAnalyzer::getInLeftSquareCount
()
21
{
22
int
leftSquareCount = 0;
23
for
(
int
i=0; i<5; i++)
24
{
25
for
(
int
j=0; j<5; j++)
26
{
27
if
(positions[i] == leftSquare[j])
28
{
29
leftSquareCount++;
30
}
31
}
32
}
33
34
return
leftSquareCount;
35
}
36
BoardAnalyzer.h
BoardAnalyzer::BoardAnalyzer
BoardAnalyzer()
Definition:
BoardAnalyzer.cpp:3
BoardAnalyzer::~BoardAnalyzer
~BoardAnalyzer()
Definition:
BoardAnalyzer.cpp:8
BoardAnalyzer::set
void set(int *initPositions)
Definition:
BoardAnalyzer.cpp:14
BoardAnalyzer::getInLeftSquareCount
int getInLeftSquareCount()
Definition:
BoardAnalyzer.cpp:20
構築:
1.8.13