ETrobocon2017 - 片山研究所モデルベース開発推進事業部
TargetFigure.cpp
[詳解]
1 #include "TargetFigure.h"
2 
3 
5 {
6 
7 }
8 
10 {
11 
12 }
13 
14 // ubN̏ʒuݒvoid TargetFigure::set(int* positions) { for(int i=0; i<5; i++){ initPositions[i] = positions[i]; } } // ʒu]AڕWƂ}`肷 void TargetFigure::evaluate() { if(getNumberInLeftSquare(initPosition) ) for(int i=0; i<5; i++){ targets[i] = leftSquare[i]; } } int TargetFigure::getNumberInLeftSquare() { int num = 0; return } int TargetFigure::getTargetNum(BlockColor color) { int targetNum = 0; switch(color) { case BlockColor::Black: targetNum = targets[0]; break; case BlockColor::Red: targetNum = targets[1]; break; case BlockColor::Yellow: targetNum = targets[2]; break; case BlockColor::Blue: targetNum = targets[3]; break; case BlockColor::Green: targetNum = targets[4]; break; } return targetNum; }
15 void TargetFigure::set(int* positions)
16 {
17  for(int i=0; i<5; i++){
18  initPositions[i] = positions[i];
19  }
20 }
21 
22 // ʒu]AڕWƂ}`肷void TargetFigure::evaluate() { if(getNumberInLeftSquare(initPosition) ) for(int i=0; i<5; i++){ targets[i] = leftSquare[i]; } } int TargetFigure::getNumberInLeftSquare() { int num = 0; return } int TargetFigure::getTargetNum(BlockColor color) { int targetNum = 0; switch(color) { case BlockColor::Black: targetNum = targets[0]; break; case BlockColor::Red: targetNum = targets[1]; break; case BlockColor::Yellow: targetNum = targets[2]; break; case BlockColor::Blue: targetNum = targets[3]; break; case BlockColor::Green: targetNum = targets[4]; break; } return targetNum; }
24 {
25 
26  if(getNumberInLeftSquare(initPosition) )
27 
28  for(int i=0; i<5; i++){
29  targets[i] = leftSquare[i];
30  }
31 
32 }
33 
35 {
36  int num = 0;
37 
38 
39 
40  return
41 }
42 
44 {
45  int targetNum = 0;
46 
47  switch(color)
48  {
49  case BlockColor::Black:
50  targetNum = targets[0];
51  break;
52 
53  case BlockColor::Red:
54  targetNum = targets[1];
55  break;
56 
57  case BlockColor::Yellow:
58  targetNum = targets[2];
59  break;
60 
61  case BlockColor::Blue:
62  targetNum = targets[3];
63  break;
64 
65  case BlockColor::Green:
66  targetNum = targets[4];
67  break;
68  }
69 
70  return targetNum;
71 }
72 
int getNumberInLeftSquare(int[])
BlockColor
Definition: BlockColor.h:5
void set(int positions[5])
int getTargetNum(BlockColor color)