Restructure project directories and update includes
Moved source files to src/, header files to include/, and documentation to docs/. Updated Visual Studio project files (.vcxproj, .vcxproj.filters) to reference new file locations and added include/ to the compiler's include path. Added .gitignore and docs/STRUCTURE.md to document the new repository structure. Removed build artifacts and user-specific files from version control.
This commit is contained in:
1 parent
7e72ef5f44
commit
4ba86f109d
34 files changed
+5575
-5427
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#ifndef __AGENTSOCK_H__
|
||||
#define __AGENTSOCK_H__
|
||||
class CAgentSocket : public CAsyncSocket {
|
||||
DECLARE_DYNAMIC(CAgentSocket);
|
||||
|
||||
public:
|
||||
CAgentSocket();
|
||||
BOOL Create(UINT nSocketPort, LPCTSTR lpszSocketAddress);
|
||||
BOOL Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress);
|
||||
BOOL Connect(LPCTSTR lpszHostAddress, UINT nHostPort);
|
||||
int ReceiveFrom(void *lpBuf, int nBufLen, CString &rSocketAddress, UINT &rSocketPort, int nFlags);
|
||||
int SendTo(const void *lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress, int nFlags);
|
||||
|
||||
void SetPort(UINT port) { m_uiPort = port; };
|
||||
UINT GetPort(void) { return m_uiPort; };
|
||||
CString GetAddress(void) { return m_sSocketAddress; };
|
||||
|
||||
protected:
|
||||
virtual void OnReceive(int nErrorCode);
|
||||
|
||||
private:
|
||||
SOCKADDR_IN sockAddr;
|
||||
UINT m_uiPort;
|
||||
CString m_sSocketAddress;
|
||||
};
|
||||
|
||||
#endif // __AGENTSOCK_H__
|
||||
@@ -0,0 +1,59 @@
|
||||
// BaseAgent.h: interface for the CBaseAgent class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_BASEAGENT_H__7FCEA561_5114_11D1_B242_0000C09B5CBE__INCLUDED_)
|
||||
#define AFX_BASEAGENT_H__7FCEA561_5114_11D1_B242_0000C09B5CBE__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "Agentsock.h"
|
||||
class CMicroClientDoc;
|
||||
class CBaseAgent : public CAgentSocket {
|
||||
public:
|
||||
CBaseAgent();
|
||||
CBaseAgent(CMicroClientDoc *m_pDoc);
|
||||
virtual ~CBaseAgent();
|
||||
BOOL ConnectAgent(LPCTSTR lpszTeam, LPCTSTR lpszServer, UINT nPort);
|
||||
void DisconnectAgent(void);
|
||||
|
||||
// communication functions
|
||||
virtual void OnReceive(int nErrorCode);
|
||||
void SendMsg(CString &strText);
|
||||
|
||||
// overridables
|
||||
virtual void OnCreatedSocket();
|
||||
virtual void OnSentMessage(LPCTSTR message) {};
|
||||
virtual void OnReceivedMessage(LPCTSTR message) {};
|
||||
|
||||
virtual void OnErrorCreatingSocket() {};
|
||||
virtual void OnErrorSendingMessage() {};
|
||||
virtual void OnErrorReceivingMessage() {};
|
||||
// the agents actions
|
||||
|
||||
// attribute fuctions
|
||||
BOOL IsConnected() { return m_bConnected; };
|
||||
void SetSide(int side) { m_iSide = side; };
|
||||
|
||||
protected:
|
||||
CString m_strTeam; // name of the team the player is in
|
||||
int m_iSide; // side on which playing
|
||||
int m_iNumber; // number of the player
|
||||
|
||||
BOOL m_bConnected; // true, if the agent is currently connected
|
||||
public:
|
||||
void SendCommand();
|
||||
CString teamname;
|
||||
BOOL ParseObject(LPCTSTR str);
|
||||
int m_iTime;
|
||||
void ParseSee(LPCTSTR str);
|
||||
int m_iPlayMode;
|
||||
void ParseInit(LPCTSTR str);
|
||||
void ParseMessage(LPCTSTR str);
|
||||
CMicroClientDoc *m_pDoc;
|
||||
send_to_team teaminfo;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_BASEAGENT_H__7FCEA561_5114_11D1_B242_0000C09B5CBE__INCLUDED_)
|
||||
@@ -0,0 +1,46 @@
|
||||
#if !defined(AFX_DSETUPDLG_H__AF3ADFE0_2D54_11D4_8C19_000021D262EF__INCLUDED_)
|
||||
#define AFX_DSETUPDLG_H__AF3ADFE0_2D54_11D4_8C19_000021D262EF__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// DSetupDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DSetupDlg dialog
|
||||
|
||||
class DSetupDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
DSetupDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(DSetupDlg)
|
||||
enum { IDD = IDD_DIALOG1 };
|
||||
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(DSetupDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
public:
|
||||
CString m_TeamName;
|
||||
CString m_ServerName;
|
||||
UINT m_Channel;
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(DSetupDlg)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DSETUPDLG_H__AF3ADFE0_2D54_11D4_8C19_000021D262EF__INCLUDED_)
|
||||
@@ -0,0 +1,145 @@
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define BORDERNUM 18
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define HIT_LEFTGOAL 0
|
||||
#define HIT_RIGHTGOAL 1
|
||||
#define HIT_UPBORDER 2
|
||||
#define HIT_DOWNBORDER 3
|
||||
#define HIT_LEFT_GOAL_UPBORDER 4
|
||||
#define HIT_LEFT_GOAL_DOWNBORDER 5
|
||||
#define HIT_RIGHT_GOAL_UPBORDER 6
|
||||
#define HIT_RIGHT_GOAL_DOWNBORDER 7
|
||||
#define HIT_LEFT_UPBORDER 8
|
||||
#define HIT_LEFT_DOWNBORDER 9
|
||||
#define HIT_RIGHT_UPBORDER 10
|
||||
#define HIT_RIGHT_DOWNBORDER 11
|
||||
#define HIT_LEFT_GOALBORDER 12
|
||||
#define HIT_RIGHT_GOALBORDER 13
|
||||
#define HIT_LEFTUPCORNER 14
|
||||
#define HIT_LEFTDOWNCORNER 15
|
||||
#define HIT_RIGHTDOWNCORNER 16
|
||||
#define HIT_RIGHTUPCORNER 17
|
||||
#define HIT_YH1 18
|
||||
#define HIT_YH2 19
|
||||
#define HIT_YHG 20
|
||||
#define HIT_BH1 21
|
||||
#define HIT_BH2 22
|
||||
#define HIT_BHG 23
|
||||
#define HIT_BALL 24
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define FRONT 0
|
||||
#define RIGHT 1
|
||||
#define BACK 2
|
||||
#define LEFT 3
|
||||
///////////////////////////////////////////////////////////////////
|
||||
#define BALL 0
|
||||
#define HOME1 1
|
||||
#define HOME2 2
|
||||
#define HOME3 3
|
||||
#define HOME4 4
|
||||
#define HOME5 5
|
||||
#define HOME6 6
|
||||
#define HOME7 7
|
||||
#define HOME8 8
|
||||
#define HOME9 9
|
||||
#define HOME10 10
|
||||
#define HGOALIE 11
|
||||
#define C_GO 0xaa
|
||||
#define C_STOP 0x55
|
||||
#define G_OFFSET 20 // 15
|
||||
#define G_ANGLE_BOUND 60
|
||||
#define G_BOUND_BOUND 10
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// 所在半场
|
||||
#define GAME_RIGHT 0
|
||||
#define GAME_LEFT 1
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define PI 3.14
|
||||
#define M_PI PI
|
||||
#define square(a) ((a) * (a))
|
||||
#define leng(a, b, c, d) sqrt(square((a) - (c)) + square((b) - (d)))
|
||||
#define pleng(a, b) sqrt(square((a.x) - (b.x)) + square((a.y) - (b.y)))
|
||||
//////////////////////////////////////////
|
||||
#define Atan(y, x) ((x == 0.0 && y == 0.0) ? (0.0) : atan2(y, x))
|
||||
#define RAD2DEG (180.0 / PI)
|
||||
#define DEG2RAD (PI / 180.0)
|
||||
#define Rad2Deg(a) ((double)a * RAD2DEG)
|
||||
#define Deg2Rad(a) ((double)a * DED2RAD)
|
||||
#define ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
/////////////////////////////////////////////////////////////
|
||||
union CCommand {
|
||||
BYTE Stream[3];
|
||||
struct tagData {
|
||||
char Lv;
|
||||
char Rv;
|
||||
char Command;
|
||||
} Data;
|
||||
CCommand &operator=(CCommand &r) {
|
||||
Data.Lv = r.Data.Lv;
|
||||
Data.Rv = r.Data.Rv;
|
||||
Data.Command = r.Data.Command;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct Robot1 {
|
||||
int angle;
|
||||
int sAngle;
|
||||
CPoint angleRef;
|
||||
CPoint sAngleRef;
|
||||
CPoint position, oldPosition;
|
||||
CPoint sPosition, sOldPosition;
|
||||
int nMethod;
|
||||
BYTE color[6];
|
||||
BOOL bAlive;
|
||||
|
||||
Robot1() {};
|
||||
BOOL find() { return TRUE; };
|
||||
BOOL entireFind() { return TRUE; };
|
||||
BOOL entireFind(BYTE *lpY, BYTE *lpU, BYTE *lpV) { return TRUE; };
|
||||
};
|
||||
|
||||
struct Robot2 {
|
||||
int angle;
|
||||
int sAngle;
|
||||
CPoint position, oldPosition;
|
||||
CPoint sPosition, sOldPosition;
|
||||
CPoint pos, oldPos, pos1, oldPos1;
|
||||
int nMethod;
|
||||
BYTE color[6];
|
||||
BOOL bAlive;
|
||||
BYTE teamColor[6];
|
||||
|
||||
Robot2() {};
|
||||
BOOL find() { return TRUE; };
|
||||
BOOL entireFind() { return TRUE; };
|
||||
BOOL entireFind(BYTE *lpY, BYTE *lpU, BYTE *lpV) { return TRUE; };
|
||||
};
|
||||
|
||||
struct Robot3 {
|
||||
CPoint position1, oldPosition1;
|
||||
CPoint sPosition1, sOldPosition1;
|
||||
CPoint position2, oldPosition2;
|
||||
CPoint sPosition2, sOldPosition2;
|
||||
CPoint position3, oldPosition3;
|
||||
CPoint position4, oldPosition4;
|
||||
CPoint position5, oldPosition5;
|
||||
CPoint sPosition3, sOldPosition3;
|
||||
CPoint position6, oldPosition6;
|
||||
CPoint position7, oldPosition7;
|
||||
CPoint position8, oldPosition8;
|
||||
CPoint position9, oldPosition9;
|
||||
CPoint position10, oldPosition10;
|
||||
CPoint position11, oldPosition11;
|
||||
int nMethod;
|
||||
BYTE color[6];
|
||||
BOOL bAlive;
|
||||
|
||||
Robot3() {};
|
||||
BOOL find1() { return TRUE; }
|
||||
BOOL find2() { return TRUE; }
|
||||
BOOL find3() { return TRUE; }
|
||||
BOOL entireFind() { return TRUE; }
|
||||
BOOL entireFind(BYTE *lpY, BYTE *lpU, BYTE *lpV) { return TRUE; }
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
// MainFrm.h : interface of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MAINFRM_H__801AABE9_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MAINFRM_H__801AABE9_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class CMainFrame : public CFrameWnd {
|
||||
|
||||
protected: // create from serialization only
|
||||
CMainFrame();
|
||||
DECLARE_DYNCREATE(CMainFrame)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMainFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CToolBar m_wndToolBar;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MAINFRM_H__801AABE9_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,47 @@
|
||||
// MicroClient.h : main header file for the MICROCLIENT application
|
||||
//
|
||||
|
||||
#if !defined(AFX_MICROCLIENT_H__801AABE5_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MICROCLIENT_H__801AABE5_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientApp:
|
||||
// See MicroClient.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CMicroClientApp : public CWinApp {
|
||||
public:
|
||||
CMicroClientApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMicroClientApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
//{{AFX_MSG(CMicroClientApp)
|
||||
afx_msg void OnAppAbout();
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MICROCLIENT_H__801AABE5_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,56 @@
|
||||
// MicroClientDoc.h : interface of the CMicroClientDoc class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MICROCLIENTDOC_H__801AABEB_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MICROCLIENTDOC_H__801AABEB_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
class CBaseAgent;
|
||||
class CMicroClientDoc : public CDocument {
|
||||
protected: // create from serialization only
|
||||
CMicroClientDoc();
|
||||
DECLARE_DYNCREATE(CMicroClientDoc)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CBaseAgent *m_pAgent;
|
||||
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMicroClientDoc)
|
||||
public:
|
||||
virtual BOOL OnNewDocument();
|
||||
virtual void Serialize(CArchive &ar);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMicroClientDoc();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMicroClientDoc)
|
||||
afx_msg void OnConnect();
|
||||
afx_msg void OnUpdateConnect(CCmdUI *pCmdUI);
|
||||
afx_msg void OnDisconnect();
|
||||
afx_msg void OnUpdateDisconnect(CCmdUI *pCmdUI);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MICROCLIENTDOC_H__801AABEB_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,60 @@
|
||||
// MicroClientView.h : interface of the CMicroClientView class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MICROCLIENTVIEW_H__801AABED_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MICROCLIENTVIEW_H__801AABED_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class CMicroClientView : public CView {
|
||||
protected: // create from serialization only
|
||||
CMicroClientView();
|
||||
DECLARE_DYNCREATE(CMicroClientView)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CMicroClientDoc *GetDocument();
|
||||
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMicroClientView)
|
||||
public:
|
||||
virtual void OnDraw(CDC *pDC); // overridden to draw this view
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
|
||||
protected:
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMicroClientView();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMicroClientView)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#ifndef _DEBUG // debug version in MicroClientView.cpp
|
||||
inline CMicroClientDoc *CMicroClientView::GetDocument() { return (CMicroClientDoc *)m_pDocument; }
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MICROCLIENTVIEW_H__801AABED_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,26 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by MicroClient.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDP_SOCKETS_INIT_FAILED 104
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_MICROCTYPE 129
|
||||
#define IDD_DIALOG1 130
|
||||
#define IDC_TEAM 1000
|
||||
#define IDC_SERVER 1001
|
||||
#define IDC_CHANNEL 1002
|
||||
#define ID_CONNECT 32771
|
||||
#define ID_DISCONNECT 32772
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 32773
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__801AABE7_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_STDAFX_H__801AABE7_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxsock.h> // MFC socket extensions
|
||||
#include <math.h>
|
||||
|
||||
#define LEFT_TO_RIGHT 0
|
||||
#define RIGHT_TO_LEFT 1
|
||||
#define MAX_PLAYER 3
|
||||
#define OWN_TEAM 0
|
||||
#define OTHER_TEAM 1
|
||||
|
||||
typedef struct pos_t {
|
||||
short enable;
|
||||
short side;
|
||||
short unum;
|
||||
short angle;
|
||||
short x;
|
||||
short y;
|
||||
} pos_t;
|
||||
|
||||
typedef struct send_to_team {
|
||||
pos_t pos[MAX_PLAYER * 2];
|
||||
|
||||
} send_to_team;
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__801AABE7_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,109 @@
|
||||
#include "general.h"
|
||||
|
||||
#ifndef _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
#define _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
|
||||
// 阵型球员相对中央球员的位置结构体
|
||||
struct RelPos {
|
||||
int id;
|
||||
double dis;
|
||||
double ang;
|
||||
};
|
||||
|
||||
class CStrategySystem : public CObject {
|
||||
DECLARE_DYNAMIC(CStrategySystem)
|
||||
public:
|
||||
void Action();
|
||||
// ~CStrategySystem();
|
||||
CStrategySystem(int id);
|
||||
void ReceiveData(Robot1 bal, Robot2 ho1, Robot2 ho2, Robot2 ho3, Robot2 ho4,
|
||||
Robot2 ho5, Robot2 ho6, Robot2 ho7, Robot2 ho8, Robot2 ho9,
|
||||
Robot2 ho10, Robot2 hgo, Robot3 opp);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#endif // _DEBUG
|
||||
private:
|
||||
void Penalty(); // 罚球
|
||||
void Freeball(); // 争球
|
||||
void Possession(); // 控球
|
||||
void Goalie(); // 守门
|
||||
|
||||
CPoint *pos; // 球员位置
|
||||
RelPos *rp; // 阵型球员相对中央球员的位置
|
||||
|
||||
int cp_id(); // 中央球员 ID
|
||||
void fp_sort(RelPos *rp, int h = 0, int t = 0); // 阵型球员排序,h 为该层前的球员数量,t 为包含该层后的球员数量
|
||||
int fm_id(); // 阵型 ID
|
||||
CPoint coor(int which); // 返回机器人的位置
|
||||
|
||||
// void spin(int which, bool isClockwise); // 自旋
|
||||
void shot1(int which, double o, CPoint t); // 直射
|
||||
bool canshot(); // 射?
|
||||
int search1(); // 查找在大区里的机器人
|
||||
int search2(); // 查找在小区里的机器人
|
||||
// CPoint searchNear(int which); // 查找最近的机器人
|
||||
// void control(int which);
|
||||
// void ccd(int which, double d, double j); // 曲线行驶
|
||||
double atwo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4); // 两直线间夹角
|
||||
// void navigate();
|
||||
void shot(int which); // 射门;
|
||||
void shot(int which, CPoint t); // 把球向 t 点射,de 向上还是向下射,de = 0从上向下射
|
||||
CPoint shooter_pos(); // 对方射门者位置
|
||||
|
||||
double Distance(CPoint point1, CPoint point2); // 计算两点之间的距离
|
||||
double Angle(CPoint point1, CPoint point2); // 计算两点之间的角度
|
||||
void Direction(int which, CPoint point);
|
||||
// void DirectionSE(int which, CPoint point); // 不进禁区版 Direction
|
||||
void PositionSE(int which, CPoint point); // 不进禁区版 Position
|
||||
void Rush(int which, CPoint point); // 冲向某点
|
||||
|
||||
int Status(); // 判断状态
|
||||
|
||||
void Stop(int which);
|
||||
void Position(int which, CPoint point);
|
||||
void Velocity(int which, int vL, int vR);
|
||||
void Angle(int which, int desired_angle);
|
||||
|
||||
CRect boundRect;
|
||||
int m_nStrategy;
|
||||
int m_OurTeam;
|
||||
int m_nGameArea;
|
||||
double ShootLen;
|
||||
int nShoot;
|
||||
int nSweep;
|
||||
int nKick2;
|
||||
CPoint ShootVar;
|
||||
CPoint KickVar;
|
||||
double KickLen;
|
||||
CCommand C_Home3;
|
||||
CCommand C_Home2;
|
||||
CCommand C_Home1;
|
||||
CCommand C_Home4;
|
||||
CCommand C_Home5;
|
||||
CCommand C_Home6;
|
||||
CCommand C_Home7;
|
||||
CCommand C_Home8;
|
||||
CCommand C_Home9;
|
||||
CCommand C_Home10;
|
||||
CCommand C_Home11;
|
||||
Robot1 ball;
|
||||
Robot2 home1, home2, home3, home4, home5, home6, home7, home8, home9, home10, hgoalie;
|
||||
Robot3 opponent;
|
||||
|
||||
bool start; // 是否刚开始
|
||||
int T; // 时间,即周期数
|
||||
struct infor {
|
||||
int num; // 球员编号
|
||||
double dis; // 球员到球的距离
|
||||
};
|
||||
bool flag;
|
||||
|
||||
// std::vector<CPoint> Navigation;
|
||||
|
||||
// void Think();
|
||||
|
||||
public:
|
||||
int command[35];
|
||||
};
|
||||
|
||||
#endif // _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
@@ -0,0 +1,31 @@
|
||||
// TParseString.h: interface for the TParseString class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_TPARSESTRING_H__B6B1C1C4_8CBF_11D1_B242_0000C09B5CBE__INCLUDED_)
|
||||
#define AFX_TPARSESTRING_H__B6B1C1C4_8CBF_11D1_B242_0000C09B5CBE__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
class TParseString : public CString {
|
||||
public:
|
||||
TParseString() { m_iPosition = 0; };
|
||||
TParseString(LPCTSTR name) : CString(name) { m_iPosition = 0; };
|
||||
|
||||
BOOL ParseBracket(TParseString &str);
|
||||
BOOL ParseString(CString &str);
|
||||
int ParseInteger();
|
||||
double ParseDouble();
|
||||
void OverreadLeadingSpaces();
|
||||
|
||||
BOOL HasErrorOccured() const { return m_bErrorOccured; };
|
||||
int GetPosition() const { return m_iPosition; };
|
||||
void SetPosition(int pos);
|
||||
|
||||
private:
|
||||
int m_iPosition;
|
||||
BOOL m_bErrorOccured;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_TPARSESTRING_H__B6B1C1C4_8CBF_11D1_B242_0000C09B5CBE__INCLUDED_)
|
||||
Reference in new issue
Block a user