// OtheroView.h : interface of the COtheroView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_OTHEROVIEW_H__6B6F55AA_363D_4F74_A263_D1039EFD3BF5__INCLUDED_)
#define AFX_OTHEROVIEW_H__6B6F55AA_363D_4F74_A263_D1039EFD3BF5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

const int ValuePlace[MASU_NUM][MASU_NUM] = {
	{45, -11, 4, -1, -1, 4, -11, 45},
	{-11, -16, -1, -3, -3, -1, -16, -11},
	{4, -1, 2, -1, -1, 2, -1, 4},
	{-1, -3, -1, 0, 0, -1, -3, -1},
	{-1, -3, -1, 0, 0, -1, -3, -1},	
	{4, -1, 2, -1, -1, 2, -1, 4},	
	{-11, -16, -1, -3, -3, -1, -16, -11},	
	{45, -11, 4, -1, -1, 4, -11, 45}};

struct Undo
{
	int x, y;
	int pointer;
	int position[30];
	Undo(int x, int y)
	{
		this->x = x;
		this->y = y;
		this->pointer = 0;
		for(int i = 0; i < 30; i++){
			this->position[i] = -1;
		}
	}
	void AddPos(int x, int y){
		position[pointer] = x + y * MASU_NUM;
		pointer++;
	}
};


class COtheroView : public CView
{
protected: // create from serialization only

	int m_Board[MASU_NUM][MASU_NUM];
	BOOL m_FlagForWhite;//手番を表すフラグ
	BOOL m_FlagForPlayer;
	BOOL m_FlagInGame;
	int m_PutNumber;
	void InitBoard(void);
	void DrawBoard(CDC* pDC);
	BOOL CanDropDown(int x, int y);
	BOOL CanDropDown(int x, int y, int vect_x, int vect_y);
	void Reverse(Undo* p_undo);
	void Reverse(Undo* p_undo, int vect_x, int vect_y);
	void InitUndo(Undo *undo, int x, int y);
	void DoUndo(Undo undo);
	int CountStone(int stone);
	void End(void);
	void DropDownStone(Undo* p_undo);
	int m_SearchLv;
	void ComputeAI(void);
	int MinMax(BOOL Flag, int lv, BOOL Put);
	int ValueBoard(void);
	int ValueBoardPlace(void);
	int ValueBoardDropDownNum(void);
	int ValueBoardNumber(void);
	COtheroView();
	DECLARE_DYNCREATE(COtheroView)


// Attributes
public:
	COtheroDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(COtheroView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~COtheroView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(COtheroView)
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnStartBlack();
	afx_msg void OnStartWhite();
	afx_msg void OnStartKuro();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in OtheroView.cpp
inline COtheroDoc* COtheroView::GetDocument()
   { return (COtheroDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_OTHEROVIEW_H__6B6F55AA_363D_4F74_A263_D1039EFD3BF5__INCLUDED_)
