From 4ba86f109db49157e3586e49d1e18a42e1a4c0ee Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Thu, 9 Oct 2025 19:31:33 +0800 Subject: [PATCH] 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. --- .gitignore | 98 + MicroClient.aps | Bin 41516 -> 0 bytes MicroClient.clw | 154 - MicroClient.ncb | Bin 142336 -> 0 bytes MicroClient.suo | Bin 26112 -> 0 bytes MicroClient.vcproj | 98 +- MicroClient.vcxproj | 123 +- MicroClient.vcxproj.filters | 44 +- MicroClient.vcxproj.user | 3 - .../Contest-Rules-2024.pdf | Bin .../Field Coordinates.jpg | Bin docs/STRUCTURE.md | 178 + Agentsock.h => include/Agentsock.h | 54 +- BaseAgent.h => include/BaseAgent.h | 118 +- DSetupDlg.h => include/DSetupDlg.h | 92 +- General.h => include/General.h | 290 +- MainFrm.h => include/MainFrm.h | 110 +- MicroClient.h => include/MicroClient.h | 94 +- MicroClientDoc.h => include/MicroClientDoc.h | 112 +- .../MicroClientView.h | 120 +- RESOURCE.H => include/RESOURCE.H | 52 +- StdAfx.h => include/StdAfx.h | 98 +- StrategySystem.h => include/StrategySystem.h | 218 +- TParseString.h => include/TParseString.h | 62 +- Agentsock.cpp => src/Agentsock.cpp | 174 +- BaseAgent.cpp => src/BaseAgent.cpp | 1026 +-- DSetupDlg.cpp => src/DSetupDlg.cpp | 88 +- MainFrm.cpp => src/MainFrm.cpp | 192 +- MicroClient.cpp => src/MicroClient.cpp | 300 +- MicroClientDoc.cpp => src/MicroClientDoc.cpp | 232 +- .../MicroClientView.cpp | 148 +- StdAfx.cpp => src/StdAfx.cpp | 32 +- StrategySystem.cpp => src/StrategySystem.cpp | 6208 ++++++++--------- TParseString.cpp => src/TParseString.cpp | 484 +- 34 files changed, 5575 insertions(+), 5427 deletions(-) create mode 100644 .gitignore delete mode 100644 MicroClient.aps delete mode 100644 MicroClient.clw delete mode 100644 MicroClient.ncb delete mode 100644 MicroClient.suo delete mode 100644 MicroClient.vcxproj.user rename Contest-Rules-2024.pdf => docs/Contest-Rules-2024.pdf (100%) rename Field Coordinates.jpg => docs/Field Coordinates.jpg (100%) create mode 100644 docs/STRUCTURE.md rename Agentsock.h => include/Agentsock.h (96%) rename BaseAgent.h => include/BaseAgent.h (83%) rename DSetupDlg.h => include/DSetupDlg.h (96%) rename General.h => include/General.h (95%) rename MainFrm.h => include/MainFrm.h (96%) rename MicroClient.h => include/MicroClient.h (96%) rename MicroClientDoc.h => include/MicroClientDoc.h (96%) rename MicroClientView.h => include/MicroClientView.h (96%) rename RESOURCE.H => include/RESOURCE.H (96%) rename StdAfx.h => include/StdAfx.h (96%) rename StrategySystem.h => include/StrategySystem.h (85%) rename TParseString.h => include/TParseString.h (96%) rename Agentsock.cpp => src/Agentsock.cpp (96%) rename BaseAgent.cpp => src/BaseAgent.cpp (96%) rename DSetupDlg.cpp => src/DSetupDlg.cpp (96%) rename MainFrm.cpp => src/MainFrm.cpp (96%) rename MicroClient.cpp => src/MicroClient.cpp (96%) rename MicroClientDoc.cpp => src/MicroClientDoc.cpp (96%) rename MicroClientView.cpp => src/MicroClientView.cpp (96%) rename StdAfx.cpp => src/StdAfx.cpp (91%) rename StrategySystem.cpp => src/StrategySystem.cpp (96%) rename TParseString.cpp => src/TParseString.cpp (94%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07f138c --- /dev/null +++ b/.gitignore @@ -0,0 +1,98 @@ +# Visual Studio Build Results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio Cache/Options +.vs/ +*.suo +*.user +*.userosscache +*.sln.docstates +*.vcxproj.user + +# Visual Studio Profiler +*.psess +*.vsp +*.vspx +*.sap + +# ReSharper +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# Build Results +[Bb]uild[Ll]og.* +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Visual C++ Cache Files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio Code +.vscode/ +*.code-workspace + +# Old Visual Studio Files +*.dsp +*.dsw +*.clw + +# Windows Image File Caches +Thumbs.db +ehthumbs.db + +# Folder Config File +Desktop.ini + +# Recycle Bin +$RECYCLE.BIN/ + +# Mac +.DS_Store + +# Temporary Files +*.swp +*~ diff --git a/MicroClient.aps b/MicroClient.aps deleted file mode 100644 index da3a2ecbaa741770ada509482b19729588957fd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41516 zcmdSC2|QHa|37{#WsguqGALA%8G8zY879jxGqzG=m&%@{l~hP&Y0;*%X?vHXY^f-+ zl+v!n8j`XlSt9d0_ugTKdVjv($M5m||G)qLtvmPL^L(CjUgvdQ=bYC$cL4wZIJmP| z*bYx8Z3ggaKHRNgA)k4uIMJWqe-90DwEbihrQj#&B;RoU(^+6iiHWowArP04qmDRhkE!0c;LK(ynUF#9)3RRhT3{aET2GcnB&r=snkl%aogsbuv-ZUjxFuAx3d%zmP4vvjACU$ z0|2pY9w0a!9^67N`yy9Cp>_QIn&(6Exy z64p!Xx!>sbc}3*2bi=j=>!PELip4dCgQpF(d#aDO500JgGyb7()H$3e#qTjv*7!wP zFjml1f`4WVPEZ*TB`iQJE&=cpC3pm5al8`zM1I`=3W4`I>Hm8|A&TKYv+sXIQ!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65|w2`@S7fSM54T|1>g3O=D z60=wt+ZNE|^DL^~ioe12=sQxl{iY1RY3x5xrSDeKwy$vBONJDt^g3pSLGLZ&w*;-h zFh1}dWl*^m{dUm1o7O@9y?d17{z@8T?21y#g1(ym!LK`8_lL z6ukI7GcTgRDI}i$f8K?`@02*SjoVQCP6t#qS{CcMg0+@L_OH@*&_D?K=l} z6?A$#moLt-&;1Vx0Du?gzCQ*0`4lh8TaWgIru9L?e=)`LdEPl!`|7qSpU>6) z67UyNJfADQ5BwAkLffCuHO_g#m*YlJJf9bwb9?Vg@qBLYhf)4CausX&Cv(U59PrAB z!SlJKIgj!iDW1>M%=p8jrhGonGUrJ?4cv|qKSl{$W9K~yY&UxKDVJmHMz$ZYjbQoH KF2~piEa!h-T4mS( diff --git a/MicroClient.clw b/MicroClient.clw deleted file mode 100644 index 229b6ab..0000000 --- a/MicroClient.clw +++ /dev/null @@ -1,154 +0,0 @@ -; CLW file contains information for the MFC ClassWizard - -[General Info] -Version=1 -LastClass=CMicroClientDoc -LastTemplate=CDialog -NewFileInclude1=#include "stdafx.h" -NewFileInclude2=#include "MicroClient.h" -LastPage=0 - -ClassCount=6 -Class1=CMicroClientApp -Class2=CMicroClientDoc -Class3=CMicroClientView -Class4=CMainFrame - -ResourceCount=5 -Resource1=IDD_DIALOG1 -Resource2=IDD_ABOUTBOX -Class5=CAboutDlg -Class6=DSetupDlg -Resource3=IDD_DIALOG1 (Chinese (P.R.C.)) -Resource4=IDD_ABOUTBOX (Chinese (P.R.C.)) -Resource5=IDR_MAINFRAME (English (U.S.)) - -[CLS:CMicroClientApp] -Type=0 -HeaderFile=MicroClient.h -ImplementationFile=MicroClient.cpp -Filter=N - -[CLS:CMicroClientDoc] -Type=0 -HeaderFile=MicroClientDoc.h -ImplementationFile=MicroClientDoc.cpp -Filter=N -BaseClass=CDocument -VirtualFilter=DC -LastObject=ID_CONNECT - -[CLS:CMicroClientView] -Type=0 -HeaderFile=MicroClientView.h -ImplementationFile=MicroClientView.cpp -Filter=C - - -[CLS:CMainFrame] -Type=0 -HeaderFile=MainFrm.h -ImplementationFile=MainFrm.cpp -Filter=T -LastObject=ID_DISCONNECT - - - - -[CLS:CAboutDlg] -Type=0 -HeaderFile=MicroClient.cpp -ImplementationFile=MicroClient.cpp -Filter=D -LastObject=CAboutDlg - -[DLG:IDD_ABOUTBOX] -Type=1 -Class=CAboutDlg -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 - -[DLG:IDD_DIALOG1] -Type=1 -Class=DSetupDlg -ControlCount=8 -Control1=IDOK,button,1342242817 -Control2=IDCANCEL,button,1342242816 -Control3=IDC_STATIC,static,1342308352 -Control4=IDC_TEAM,edit,1350631552 -Control5=IDC_STATIC,static,1342308352 -Control6=IDC_SERVER,edit,1350631552 -Control7=IDC_STATIC,static,1342308352 -Control8=IDC_CHANNEL,edit,1350631552 - -[CLS:DSetupDlg] -Type=0 -HeaderFile=DSetupDlg.h -ImplementationFile=DSetupDlg.cpp -BaseClass=CDialog -Filter=D -LastObject=DSetupDlg -VirtualFilter=dWC - -[MNU:IDR_MAINFRAME (English (U.S.))] -Type=1 -Class=CMainFrame -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_FILE_SAVE_AS -Command5=ID_APP_EXIT -Command6=ID_APP_ABOUT -CommandCount=6 - -[TB:IDR_MAINFRAME (English (U.S.))] -Type=1 -Class=CMainFrame -Command1=ID_CONNECT -Command2=ID_DISCONNECT -Command3=ID_APP_ABOUT -CommandCount=3 - -[ACL:IDR_MAINFRAME (English (U.S.))] -Type=1 -Class=CMainFrame -Command1=ID_FILE_NEW -Command2=ID_FILE_OPEN -Command3=ID_FILE_SAVE -Command4=ID_EDIT_UNDO -Command5=ID_EDIT_CUT -Command6=ID_EDIT_COPY -Command7=ID_EDIT_PASTE -Command8=ID_EDIT_UNDO -Command9=ID_EDIT_CUT -Command10=ID_EDIT_COPY -Command11=ID_EDIT_PASTE -Command12=ID_NEXT_PANE -Command13=ID_PREV_PANE -CommandCount=13 - -[DLG:IDD_DIALOG1 (Chinese (P.R.C.))] -Type=1 -Class=? -ControlCount=8 -Control1=IDOK,button,1342242817 -Control2=IDCANCEL,button,1342242816 -Control3=IDC_STATIC,static,1342308352 -Control4=IDC_TEAM,edit,1350631552 -Control5=IDC_STATIC,static,1342308352 -Control6=IDC_SERVER,edit,1350631552 -Control7=IDC_STATIC,static,1342308352 -Control8=IDC_CHANNEL,edit,1350631552 - -[DLG:IDD_ABOUTBOX (Chinese (P.R.C.))] -Type=1 -Class=? -ControlCount=4 -Control1=IDC_STATIC,static,1342177283 -Control2=IDC_STATIC,static,1342308480 -Control3=IDC_STATIC,static,1342308352 -Control4=IDOK,button,1342373889 - diff --git a/MicroClient.ncb b/MicroClient.ncb deleted file mode 100644 index de70b03962d3a245551dc2623678512a004599a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 142336 zcmeEv2Yg+{mG^nq>Xxi#8y76D3+~vGEL*Yw^VDq1sA0)A27@e1&$2+46iIHBARI_c z0_l(q%a@O|4J5n3ZW5AZQ@kXkY|4_d*?dVzAe3ZxlU))vq{H|BpSf+G4D=FFLy#-7f>{-OTe!*0#Wnq|w}#@6+2`HJG=oUB>3t%55>B!-)~?t@$PS7qW_=9 zf0`zkR+z;IXE{s-OfAd~m_8WdZ-ya$FU*55#1F&Gr(h%Za_YX$?_Vn}(4R((K#>>jrwU1xw>O0p`oAgkZW5L z!}|tmd%Mqg$c-I6ed`DJp80So$ugh*Y=&Li-+4BJ-`bNnaK^)L9qy{yeef&Ot z=swhXXlOWb<_la~OUK|)qIGz%r|-incP^V4vB*t>)Sb8l2-$ zPk&#?!Wx!#WoPA%0q~=P9edr~J-vyc9eaamvi&_n`#O5vq2Ya9J^k*AzQnLgZgj`~ z&hi~SeVx7gx)M8j`iF)G6CHc~Z)zClmF?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Gwm-@ zxm+cul2<9H^s8)Dxk6=|3ez%EJ<}gkBhxdF1pK{0h3Pn)6}hkY zNIFNKJUZU4!j!I=yf`H@Ju_wV7+`8{QPHekd~7iFGClKX;=D2C@;KvBpwm%&gz#A5 z(fH>oYgBj)fVt&4`Zkq6Q(2`Dd5P2Z-K;(hQ1Ca+J j4@4e_JP>&x@<8N)$ODlFA`e6!h&&K^Ao9R#^uYfCz~z@a diff --git a/MicroClient.suo b/MicroClient.suo deleted file mode 100644 index 675022bccc6fdbceef4a92c196726fee6aae2bd7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26112 zcmeHP3wTu3wLak`uL~lmpr{d0s4(L^l1v6f$rI27qKPrqv^trb2_uu4bY>z%;TB)0 zT%l-Hd?F|oix#xL@lDm%O2un!t=4NxB|!b|_w`;sd$qj^_y5m6J9B1oX69s)o8Z0O z^ZjSTUn za}6j)l*^TcpdLV~LRp@rl;qpTK?6zpjFa!CKcmbt)G0nCrYu#elpx}`av_c?c#_v+ zB3s(yG-Xg8`-0>lZAQZl>QMGChJ{MKQma%e<%(#DHjR25Z=qCcnPoaZB6s)W8KCdM zW%fC%^*8EkrU||i>H+Eic}?m7c`o}ubpmw&+mLnVefEEukGxP1q|*V^HPiw50Q*1n zz-xfj{!e{DT2cqNaP9^QfI^@M;QeAfrl`#U&I0BFX9MQ|^MDed6p*|d;{~|B5I7e& z52ymFfknV#fO*eHe1V>>)8l%?7Xb~x#lW|LOMn{zWBHfi+^1jjBW~8ymm_WgmHc{e8r%fGf6NbMB*We6r}lNfj@z z{?ikAxYVQYA7vaRau1ZL(FeD`)Vbw`{p+^wd;Vz_HMT6;5sUjm`4^~dk!W1&gTwaU z{@DJt+j)CrLv>aD{*6!X-*_EQkLld;+`%39?ccomzzcUAeCd|XyB_A{aR;_O-?`@D z{EO74`~%xI?0fNtygD-Zbl8FCuhWT+xhNQJjx38AG7ni$SIw8MjP1N>+rcNF+<)K8 zoiA-WuxFLV zcv+)_AZ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PS^SIT#+>Y!p7w*(ciDYMp7@VYZdO%Kxk=wfR`k30`X+s8;wx$C{90yZZS1G< z%k0Z-R{GBi<`Dw`S{~+T|TLJNU9be=<&BN>Oeb+o-+OqRM_*wp);(7{;_{k zdrNxFVrA4d*6hZ9k-t>_`PLGe$GX*LykVl2Zz0kz|HzB#J zrVgGp?DoT79J67@@`mB-Ytu`vD1bDNv~>?N{{{Dp$af@Ty$SwbN7?1SAY=P*{gE>& zuF|qyGiKIrK8u)O$WEUt+vx-4pFR=l39Iys z+s)2hs6K69s`!4Gm9PJb|6g#1(-WEAh5Q{Pj*zYX{7Q7D!1pg{TW$XjP@whp=g5*i b + Name="Win32" /> + DebugInformationFormat="4" /> + Name="VCCustomBuildTool" /> + TargetMachine="1" /> + HeaderFileName="" /> + Name="VCPostBuildEventTool" /> + Name="VCPreBuildEventTool" /> + Name="VCPreLinkEventTool" /> + Culture="2052" /> + Name="VCWebServiceProxyGeneratorTool" /> + Name="VCXMLDataGeneratorTool" /> + Name="VCWebDeploymentTool" /> + Name="VCManagedWrapperGeneratorTool" /> + Name="VCAuxiliaryManagedWrapperGeneratorTool" /> + SuppressStartupBanner="TRUE" /> + Name="VCCustomBuildTool" /> + TargetMachine="1" /> + HeaderFileName="" /> + Name="VCPostBuildEventTool" /> + Name="VCPreBuildEventTool" /> + Name="VCPreLinkEventTool" /> + Culture="2052" /> + Name="VCWebServiceProxyGeneratorTool" /> + Name="VCXMLDataGeneratorTool" /> + Name="VCWebDeploymentTool" /> + Name="VCManagedWrapperGeneratorTool" /> + Name="VCAuxiliaryManagedWrapperGeneratorTool" /> @@ -154,7 +154,7 @@ Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="" - BasicRuntimeChecks="3"/> + BasicRuntimeChecks="3" /> @@ -162,7 +162,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -181,7 +181,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -200,7 +200,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -219,7 +219,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -238,7 +238,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -260,7 +260,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -279,7 +279,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + UsePrecompiledHeader="1" /> @@ -300,7 +300,7 @@ Optimization="2" PreprocessorDefinitions="" UsePrecompiledHeader="1" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -319,7 +319,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> + BasicRuntimeChecks="3" /> @@ -338,7 +338,7 @@ Name="VCCLCompilerTool" Optimization="2" PreprocessorDefinitions="" - BrowseInformation="1"/> + BrowseInformation="1" /> @@ -405,6 +405,6 @@ + Value="MicroClient.rc" /> - + \ No newline at end of file diff --git a/MicroClient.vcxproj b/MicroClient.vcxproj index 81d28bf..4053921 100644 --- a/MicroClient.vcxproj +++ b/MicroClient.vcxproj @@ -1,5 +1,6 @@  - + Debug @@ -41,10 +42,14 @@ - + - + @@ -58,16 +63,19 @@ AllRules.ruleset - AllRules.ruleset + + AllRules.ruleset - AllRules.ruleset + + AllRules.ruleset Disabled + $(ProjectDir)include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -107,6 +115,7 @@ MaxSpeed OnlyExplicitInline + $(ProjectDir)include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true MultiThreadedDebug @@ -144,86 +153,106 @@ - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks Create MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) Create true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true - + Disabled - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) EnableFastChecks MaxSpeed - %(PreprocessorDefinitions) + + %(PreprocessorDefinitions) true @@ -231,18 +260,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/MicroClient.vcxproj.filters b/MicroClient.vcxproj.filters index 7b01e0d..61dc87e 100644 --- a/MicroClient.vcxproj.filters +++ b/MicroClient.vcxproj.filters @@ -15,34 +15,34 @@ - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + Source Files @@ -52,40 +52,40 @@ - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files diff --git a/MicroClient.vcxproj.user b/MicroClient.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/MicroClient.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/Contest-Rules-2024.pdf b/docs/Contest-Rules-2024.pdf similarity index 100% rename from Contest-Rules-2024.pdf rename to docs/Contest-Rules-2024.pdf diff --git a/Field Coordinates.jpg b/docs/Field Coordinates.jpg similarity index 100% rename from Field Coordinates.jpg rename to docs/Field Coordinates.jpg diff --git a/docs/STRUCTURE.md b/docs/STRUCTURE.md new file mode 100644 index 0000000..b600186 --- /dev/null +++ b/docs/STRUCTURE.md @@ -0,0 +1,178 @@ +# ATRI-2024 Repository Structure + +This document describes the reorganized file structure for the ATRI-2024 FIRA SimuroSot 11vs11 client repository. + +## Directory Structure + +``` +ATRI-2024/ +├── src/ # Source code files (.cpp) +│ ├── Agentsock.cpp # Socket communication implementation +│ ├── BaseAgent.cpp # Base agent class implementation +│ ├── DSetupDlg.cpp # Setup dialog implementation +│ ├── MainFrm.cpp # Main frame window implementation +│ ├── MicroClient.cpp # Main application implementation +│ ├── MicroClientDoc.cpp # Document class implementation +│ ├── MicroClientView.cpp # View class implementation +│ ├── StdAfx.cpp # Precompiled header source +│ ├── StrategySystem.cpp # Core strategy system implementation +│ └── TParseString.cpp # String parsing utilities +│ +├── include/ # Header files (.h) +│ ├── Agentsock.h # Socket communication interface +│ ├── BaseAgent.h # Base agent class interface +│ ├── DSetupDlg.h # Setup dialog interface +│ ├── General.h # General definitions and structures +│ ├── MainFrm.h # Main frame window interface +│ ├── MicroClient.h # Main application interface +│ ├── MicroClientDoc.h # Document class interface +│ ├── MicroClientView.h # View class interface +│ ├── Resource.h # Resource IDs +│ ├── StdAfx.h # Precompiled header +│ ├── StrategySystem.h # Strategy system interface +│ └── TParseString.h # String parsing utilities interface +│ +├── res/ # Resource files +│ ├── MicroClient.ico # Application icon +│ ├── MicroClient.rc2 # Additional resources +│ ├── MicroClientDoc.ico # Document icon +│ └── Toolbar.bmp # Toolbar bitmap +│ +├── docs/ # Documentation +│ ├── Contest-Rules-2024.pdf # Competition rules +│ └── Field Coordinates.jpg # Field coordinate system reference +│ +├── MicroClient.sln # Visual Studio solution file +├── MicroClient.vcxproj # Visual Studio project file (VS 2010+) +├── MicroClient.vcxproj.filters # Project filters +├── MicroClient.rc # Resource script +├── MicroClient.dsp # Legacy project file (VS 6.0) +├── MicroClient.dsw # Legacy workspace file (VS 6.0) +├── MicroClient.vcproj # Legacy project file (VS 2008) +├── .gitignore # Git ignore rules +├── README.md # Main documentation (English) +└── LICENSE # License file + +``` + +## Key Changes from Original Structure + +### Organization + +- **Source files** moved from root to `src/` directory +- **Header files** moved from root to `include/` directory +- **Documentation** moved to `docs/` directory +- **Resources** reorganized in `res/` directory (lowercase) + +### Project Configuration + +- Updated `MicroClient.vcxproj` to reference new file locations +- Added `include` directory to Additional Include Directories +- Updated `MicroClient.vcxproj.filters` to match new structure + +### New Files + +- **README.md**: Comprehensive English documentation +- **.gitignore**: Excludes build artifacts and temporary files +- **docs/STRUCTURE.md**: This file - documents repository organization + +### Removed from Git + +Build artifacts and temporary files (via .gitignore): + +- `*.suo`, `*.user` - User-specific Visual Studio files +- `*.aps`, `*.clw`, `*.ncb` - Build cache files +- `Debug/`, `Release/` - Build output directories + +## Building the Project + +The project can still be built using: + +- **Visual Studio 2010 or later**: Open `MicroClient.sln` +- **Visual Studio 6.0** (legacy): Open `MicroClient.dsw` + +The project files have been updated to automatically find source and header files in their new locations. + +## Core Components + +### Strategy System (`StrategySystem.cpp/h`) + +Main decision-making logic for the robot team: + +- Penalty kicks handling +- Free ball (争球) strategy +- Ball possession/offensive play +- Goalkeeper logic +- Dynamic formation management + +### Agent System (`BaseAgent.cpp/h`, `Agentsock.cpp/h`) + +Robot agent framework: + +- Base agent class for robot behavior +- Socket communication with simulation server +- Real-time data exchange + +### User Interface (`MicroClientView.cpp/h`, `MainFrm.cpp/h`) + +MFC-based graphical interface: + +- Game visualization +- Real-time monitoring +- Control panel + +### Configuration (`DSetupDlg.cpp/h`) + +Setup and configuration: + +- Connection settings +- Team configuration +- Strategy parameters + +## Development Guidelines + +### Adding New Files + +**Source files (.cpp)**: + +- Place in `src/` directory +- Add to `MicroClient.vcxproj` under `` +- Add to `MicroClient.vcxproj.filters` under Source Files filter + +**Header files (.h)**: + +- Place in `include/` directory +- Add to `MicroClient.vcxproj` under `` +- Add to `MicroClient.vcxproj.filters` under Header Files filter +- Include in source files as: `#include "filename.h"` (include directory is in path) + +**Resources**: + +- Place in `res/` directory +- Reference in `MicroClient.rc` as needed + +### Include Path + +The `include/` directory is automatically added to the compiler's include path, so headers can be included directly: + +```cpp +#include "StrategySystem.h" // Not #include "include/StrategySystem.h" +``` + +## License + +This project uses a custom Noncommercial No-Derivatives Software License (NCND-Software-1.0). + +- ✅ Free for non-commercial use (education, research, personal) +- ✅ Can use and distribute unmodified code +- ❌ No commercial use allowed +- ❌ No distribution of modified versions + +See [LICENSE](../LICENSE) file for complete terms. + +## Team + +Developed by ATRI (Ace Team of Robotics Intelligence) for the 2024 China Robot Competition & RoboCup China Open. + +- Team Leader: @xixu-me +- Members: @XIAOLingQ, @Wx-debug, @moxun333, @song-yaya, @huaxiaoshi, @biqianq, @isWorldEdit diff --git a/Agentsock.h b/include/Agentsock.h similarity index 96% rename from Agentsock.h rename to include/Agentsock.h index a920d75..4643fdd 100644 --- a/Agentsock.h +++ b/include/Agentsock.h @@ -1,27 +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__ +#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__ diff --git a/BaseAgent.h b/include/BaseAgent.h similarity index 83% rename from BaseAgent.h rename to include/BaseAgent.h index 77f073a..3be2401 100644 --- a/BaseAgent.h +++ b/include/BaseAgent.h @@ -1,59 +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_) +// 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_) diff --git a/DSetupDlg.h b/include/DSetupDlg.h similarity index 96% rename from DSetupDlg.h rename to include/DSetupDlg.h index 695f156..38a1b81 100644 --- a/DSetupDlg.h +++ b/include/DSetupDlg.h @@ -1,46 +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_) +#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_) diff --git a/General.h b/include/General.h similarity index 95% rename from General.h rename to include/General.h index 0886979..5fcc5b2 100644 --- a/General.h +++ b/include/General.h @@ -1,145 +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; } -}; +///////////////////////////////////////////////////////////////// +#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; } +}; diff --git a/MainFrm.h b/include/MainFrm.h similarity index 96% rename from MainFrm.h rename to include/MainFrm.h index a682bb0..418b5d0 100644 --- a/MainFrm.h +++ b/include/MainFrm.h @@ -1,55 +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_) +// 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_) diff --git a/MicroClient.h b/include/MicroClient.h similarity index 96% rename from MicroClient.h rename to include/MicroClient.h index 7fa3ae5..4c06085 100644 --- a/MicroClient.h +++ b/include/MicroClient.h @@ -1,47 +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_) +// 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_) diff --git a/MicroClientDoc.h b/include/MicroClientDoc.h similarity index 96% rename from MicroClientDoc.h rename to include/MicroClientDoc.h index 10a0e85..f383bd0 100644 --- a/MicroClientDoc.h +++ b/include/MicroClientDoc.h @@ -1,56 +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_) +// 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_) diff --git a/MicroClientView.h b/include/MicroClientView.h similarity index 96% rename from MicroClientView.h rename to include/MicroClientView.h index 6656688..f449a65 100644 --- a/MicroClientView.h +++ b/include/MicroClientView.h @@ -1,60 +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_) +// 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_) diff --git a/RESOURCE.H b/include/RESOURCE.H similarity index 96% rename from RESOURCE.H rename to include/RESOURCE.H index f0601b1..7b57996 100644 --- a/RESOURCE.H +++ b/include/RESOURCE.H @@ -1,26 +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 +//{{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 diff --git a/StdAfx.h b/include/StdAfx.h similarity index 96% rename from StdAfx.h rename to include/StdAfx.h index ab7f791..455ef0f 100644 --- a/StdAfx.h +++ b/include/StdAfx.h @@ -1,49 +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 // MFC core and standard components -#include // MFC extensions -#include // MFC Automation classes -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include // MFC socket extensions -#include - -#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_) +// 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 // MFC core and standard components +#include // MFC extensions +#include // MFC Automation classes +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include // MFC socket extensions +#include + +#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_) diff --git a/StrategySystem.h b/include/StrategySystem.h similarity index 85% rename from StrategySystem.h rename to include/StrategySystem.h index 0feb2a2..dd52157 100644 --- a/StrategySystem.h +++ b/include/StrategySystem.h @@ -1,109 +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 Navigation; - - // void Think(); - -public: - int command[35]; -}; - -#endif // _INSIDE_VISUAL_CPP_STRATEGYSYSTEM +#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 Navigation; + + // void Think(); + +public: + int command[35]; +}; + +#endif // _INSIDE_VISUAL_CPP_STRATEGYSYSTEM diff --git a/TParseString.h b/include/TParseString.h similarity index 96% rename from TParseString.h rename to include/TParseString.h index 3faf9f7..78c7bef 100644 --- a/TParseString.h +++ b/include/TParseString.h @@ -1,31 +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_) +// 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_) diff --git a/Agentsock.cpp b/src/Agentsock.cpp similarity index 96% rename from Agentsock.cpp rename to src/Agentsock.cpp index 87aef82..e1fbc17 100644 --- a/Agentsock.cpp +++ b/src/Agentsock.cpp @@ -1,87 +1,87 @@ - -#include "stdafx.h" -#include "Agentsock.h" -#ifdef _DEBUG -#undef THIS_FILE -static char BASED_CODE THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CAgentSocket, CAsyncSocket) - -CAgentSocket::CAgentSocket() { - m_uiPort = 0; - m_sSocketAddress = _T(""); -} - -void CAgentSocket::OnReceive(int nErrorCode) { - CAsyncSocket::OnReceive(nErrorCode); -} - -BOOL CAgentSocket::Create(UINT nSocketPort, LPCTSTR lpszSocketAddress) { - int nSocketType = SOCK_DGRAM; - long lEvent = FD_READ | FD_WRITE | FD_ACCEPT | FD_CONNECT | FD_CLOSE; - - // create the socket - if (Socket(nSocketType, lEvent)) { - // try to bind the socket to any address - if (Bind(nSocketPort, lpszSocketAddress)) - return TRUE; - - // an error occured - int nResult = GetLastError(); - Close(); - WSASetLastError(nResult); - } - return FALSE; -} - -BOOL CAgentSocket::Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress) { - int result; - - // bind to INADDR_ANY - memset(&sockAddr, 0, sizeof(sockAddr)); - sockAddr.sin_family = AF_INET; - sockAddr.sin_addr.s_addr = htonl(INADDR_ANY); - sockAddr.sin_port = htons(0); - result = CAsyncSocket::Bind((SOCKADDR *)&sockAddr, sizeof(sockAddr)); - - // set the proper values of port and address for the following SendTo commands - memset(&sockAddr, 0, sizeof(sockAddr)); - LPSTR lpszAscii = (LPTSTR)lpszSocketAddress; - sockAddr.sin_family = AF_INET; - sockAddr.sin_addr.s_addr = inet_addr(lpszAscii); - if (sockAddr.sin_addr.s_addr == INADDR_NONE) { - // get the address from a nameserver - LPHOSTENT lphost; - lphost = gethostbyname(lpszAscii); - if (lphost != NULL) - sockAddr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr; - else { - WSASetLastError(WSAEINVAL); - return FALSE; - } - } - sockAddr.sin_port = htons((u_short)nSocketPort); - - // return the result of the Bind command - return result; -} - -int CAgentSocket::ReceiveFrom(void *lpBuf, int nBufLen, CString &rSocketAddress, UINT &rSocketPort, int nFlags) { - // try to receive data - memset(&sockAddr, 0, sizeof(sockAddr)); - int nSockAddrLen = sizeof(sockAddr); - int nResult = CAsyncSocket::ReceiveFrom(lpBuf, nBufLen, (SOCKADDR *)&sockAddr, &nSockAddrLen, nFlags); - if (nResult != SOCKET_ERROR) { - // succesfull - rSocketPort = ntohs(sockAddr.sin_port); - rSocketAddress = inet_ntoa(sockAddr.sin_addr); - } - - return nResult; -} - -int CAgentSocket::SendTo(const void *lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress, int nFlags) { - // send the buffer - return CAsyncSocket::SendTo(lpBuf, nBufLen, (SOCKADDR *)&sockAddr, sizeof(sockAddr), nFlags); -} + +#include "stdafx.h" +#include "Agentsock.h" +#ifdef _DEBUG +#undef THIS_FILE +static char BASED_CODE THIS_FILE[] = __FILE__; +#endif + +IMPLEMENT_DYNAMIC(CAgentSocket, CAsyncSocket) + +CAgentSocket::CAgentSocket() { + m_uiPort = 0; + m_sSocketAddress = _T(""); +} + +void CAgentSocket::OnReceive(int nErrorCode) { + CAsyncSocket::OnReceive(nErrorCode); +} + +BOOL CAgentSocket::Create(UINT nSocketPort, LPCTSTR lpszSocketAddress) { + int nSocketType = SOCK_DGRAM; + long lEvent = FD_READ | FD_WRITE | FD_ACCEPT | FD_CONNECT | FD_CLOSE; + + // create the socket + if (Socket(nSocketType, lEvent)) { + // try to bind the socket to any address + if (Bind(nSocketPort, lpszSocketAddress)) + return TRUE; + + // an error occured + int nResult = GetLastError(); + Close(); + WSASetLastError(nResult); + } + return FALSE; +} + +BOOL CAgentSocket::Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress) { + int result; + + // bind to INADDR_ANY + memset(&sockAddr, 0, sizeof(sockAddr)); + sockAddr.sin_family = AF_INET; + sockAddr.sin_addr.s_addr = htonl(INADDR_ANY); + sockAddr.sin_port = htons(0); + result = CAsyncSocket::Bind((SOCKADDR *)&sockAddr, sizeof(sockAddr)); + + // set the proper values of port and address for the following SendTo commands + memset(&sockAddr, 0, sizeof(sockAddr)); + LPSTR lpszAscii = (LPTSTR)lpszSocketAddress; + sockAddr.sin_family = AF_INET; + sockAddr.sin_addr.s_addr = inet_addr(lpszAscii); + if (sockAddr.sin_addr.s_addr == INADDR_NONE) { + // get the address from a nameserver + LPHOSTENT lphost; + lphost = gethostbyname(lpszAscii); + if (lphost != NULL) + sockAddr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr; + else { + WSASetLastError(WSAEINVAL); + return FALSE; + } + } + sockAddr.sin_port = htons((u_short)nSocketPort); + + // return the result of the Bind command + return result; +} + +int CAgentSocket::ReceiveFrom(void *lpBuf, int nBufLen, CString &rSocketAddress, UINT &rSocketPort, int nFlags) { + // try to receive data + memset(&sockAddr, 0, sizeof(sockAddr)); + int nSockAddrLen = sizeof(sockAddr); + int nResult = CAsyncSocket::ReceiveFrom(lpBuf, nBufLen, (SOCKADDR *)&sockAddr, &nSockAddrLen, nFlags); + if (nResult != SOCKET_ERROR) { + // succesfull + rSocketPort = ntohs(sockAddr.sin_port); + rSocketAddress = inet_ntoa(sockAddr.sin_addr); + } + + return nResult; +} + +int CAgentSocket::SendTo(const void *lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress, int nFlags) { + // send the buffer + return CAsyncSocket::SendTo(lpBuf, nBufLen, (SOCKADDR *)&sockAddr, sizeof(sockAddr), nFlags); +} diff --git a/BaseAgent.cpp b/src/BaseAgent.cpp similarity index 96% rename from BaseAgent.cpp rename to src/BaseAgent.cpp index 20f56e9..3716a16 100644 --- a/BaseAgent.cpp +++ b/src/BaseAgent.cpp @@ -1,513 +1,513 @@ - -#include "stdafx.h" -#include "Agentsock.h" -#include -#include "MicroClientDoc.h" -#include "TParseString.h" -#include "StrategySystem.h" -#include "BaseAgent.h" -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#define new DEBUG_NEW -#endif -extern Robot2 r[2][11]; -extern Robot3 op; -extern Robot1 theball; -extern CStrategySystem *thePlannerR; -extern CStrategySystem *thePlannerL; - -// extern FILE* fp; -#define MAX_MSG_LENGTH 1500 -CBaseAgent::CBaseAgent() { - m_bConnected = FALSE; - m_iSide = LEFT_TO_RIGHT; - m_iNumber = 0; -} - -CBaseAgent::CBaseAgent(CMicroClientDoc *m_Doc) { - m_pDoc = m_Doc; - m_bConnected = FALSE; - m_iSide = LEFT_TO_RIGHT; - m_iNumber = 0; -} -CBaseAgent::~CBaseAgent() { - DisconnectAgent(); -} - -BOOL CBaseAgent::ConnectAgent(LPCTSTR lpszTeam, LPCTSTR lpszServer, UINT nPort) { - // is the agent already connected (should not happen) - if (m_bConnected) - return FALSE; - - // create the datagram socket - if (!Create(nPort, lpszServer)) { - // socket could not be created - OnErrorCreatingSocket(); - return FALSE; - } - else { - m_bConnected = TRUE; - m_strTeam = lpszTeam; - OnCreatedSocket(); - Sleep(100); - return TRUE; - } -} -void CBaseAgent::OnCreatedSocket() { - CString message; - - // send the (init team) command - message.Format("(init %s (version 4.00))", (LPCTSTR)m_strTeam); - SendMsg(message); -} - -void CBaseAgent::DisconnectAgent() { - // is the socket active ? - if (m_bConnected) { - BYTE Buffer[50]; - - ShutDown(); - while (Receive(Buffer, 50) > 0) - ; - Close(); - } - m_bConnected = FALSE; -} - -void CBaseAgent::SendMsg(CString &strText) { - int iLength; - - // send the buffer - iLength = SendTo(strText, strText.GetLength(), GetPort(), GetAddress(), 0); - if (iLength == strText.GetLength()) - OnSentMessage((LPCTSTR)strText); - else { -// an error occured -#ifdef _DEBUG - afxDump << "error writing to socket\n"; -#endif - OnErrorSendingMessage(); - } -} - -void CBaseAgent::OnReceive(int iError) { - char buffer[MAX_MSG_LENGTH]; - int iLength = 0; - UINT iPort = GetPort(); - int iPosition = 0; - - // first call base classes method - CAgentSocket::OnReceive(iError); - - // read a message from the socket - iLength = ReceiveFrom(buffer, MAX_MSG_LENGTH, GetAddress(), iPort, 0); - // the port may have changed - SetPort(iPort); - - if (iLength > 0) { - // OnReceivedMessage((LPCTSTR) buffer); - ParseMessage((LPCTSTR)buffer); - if (m_iSide == LEFT_TO_RIGHT) { - thePlannerL->ReceiveData(theball, r[0][0], r[0][1], r[0][2], r[0][3], r[0][4], - r[0][5], r[0][6], r[0][7], r[0][8], r[0][9], r[0][10], op); - thePlannerL->Action(); - } - else if (m_iSide == RIGHT_TO_LEFT) { - thePlannerR->ReceiveData(theball, r[0][0], r[0][1], r[0][2], r[0][3], r[0][4], - r[0][5], r[0][6], r[0][7], r[0][8], r[0][9], r[0][10], op); - thePlannerR->Action(); - } - SendCommand(); - } - else { -// an error occured -#ifdef _DEBUG - afxDump << "error reading socket\n"; -#endif - OnErrorReceivingMessage(); - } -} - -void CBaseAgent::ParseMessage(LPCTSTR str) { - switch (str[1]) { - case 's': - if (str[3] == 'e') - - ParseSee(str); - break; - case 'i': - AfxMessageBox("Init successful"); - ParseInit(str); - break; - } - // return TRUE; -} - -void CBaseAgent::ParseInit(LPCTSTR str) { - - TParseString msg(str); - CString tmp; - // int number; - - // get the side - if ((msg.GetLength() > 6) && (msg.GetAt(6) == 'r')) { - AfxMessageBox("right right"); - SetSide(RIGHT_TO_LEFT); - } - else { - SetSide(LEFT_TO_RIGHT); - } - - // return TRUE; -} - -void CBaseAgent::ParseSee(LPCTSTR str) { - TParseString msg(str); - TParseString strObject; - - msg.SetPosition(5); - m_iTime = msg.ParseInteger(); - if (msg.HasErrorOccured()) - return; - - while (msg.ParseBracket(strObject)) { - if (!ParseObject(strObject)) { -#ifdef _DEBUG - CString error; - error.Format(" : error parsing object info at position %d !\n", strObject.GetPosition()); - afxDump << error << strObject; -#endif - } - } -} - -BOOL CBaseAgent::ParseObject(LPCTSTR str) { - TParseString msg(str); - TParseString name; - CString teamname; - int team; - int iNum; - int x; - int y; - double angle; - - // read the objects name bracket - if (!msg.ParseBracket(name)) // name="player TeamName TeamNum" - return FALSE; - x = msg.ParseInteger(); - if (msg.HasErrorOccured()) { - } - y = msg.ParseInteger(); - if (msg.HasErrorOccured()) { - } - angle = msg.ParseDouble(); - if (msg.HasErrorOccured()) { - } - switch (name.GetAt(0)) { - // it is a player - case 'P': - case 'p': - name.SetPosition(7); - // read the teamname - if (name.ParseString(teamname)) { - // ist it my team ? - if (teamname.Compare(_T(name)) == 0) - team = OWN_TEAM; - else - team = OTHER_TEAM; - - // read player number - iNum = name.ParseInteger(); - if (msg.HasErrorOccured()) { - } - } - switch (iNum) { - case 1: - if (m_iSide == LEFT_TO_RIGHT) { - r[0][0].position.x = x; - r[0][0].position.y = y; - r[0][0].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position1.x = x; - op.position1.y = y; - } - break; - case 2: // ×󷽶þºŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][1].position.x = x; - r[0][1].position.y = y; - r[0][1].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position2.x = x; - op.position2.y = y; - } - break; - case 3: // ×ó·½ÈýºŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][2].position.x = x; - r[0][2].position.y = y; - r[0][2].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position3.x = x; - op.position3.y = y; - } - break; - case 4: // ×ó·½ËĺŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][3].position.x = x; - r[0][3].position.y = y; - r[0][3].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position4.x = x; - op.position4.y = y; - } - break; - case 5: // ×ó·½ÎåºŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][4].position.x = x; - r[0][4].position.y = y; - r[0][4].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position5.x = x; - op.position5.y = y; - } - break; - case 6: // ×ó·½ÁùºŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][5].position.x = x; - r[0][5].position.y = y; - r[0][5].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position6.x = x; - op.position6.y = y; - } - break; - case 7: // ×󷽯ߺŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][6].position.x = x; - r[0][6].position.y = y; - r[0][6].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position7.x = x; - op.position7.y = y; - } - break; - case 8: // ×󷽰˺ŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][7].position.x = x; - r[0][7].position.y = y; - r[0][7].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position8.x = x; - op.position8.y = y; - } - break; - case 9: // ×󷽾źŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][8].position.x = x; - r[0][8].position.y = y; - r[0][8].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position9.x = x; - op.position9.y = y; - } - break; - case 10: // ×ó·½ʮºŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][9].position.x = x; - r[0][9].position.y = y; - r[0][9].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position10.x = x; - op.position10.y = y; - } - break; - case 11: // ×ó·½ʮһºŶÓԱµÄ×ø±ê - if (m_iSide == LEFT_TO_RIGHT) { - r[0][10].position.x = x; - r[0][10].position.y = y; - r[0][10].angle = (int)angle; - } - else if (m_iSide == RIGHT_TO_LEFT) { - op.position11.x = x; - op.position11.y = y; - } - break; - // ÏÂÃæµÄÊǴÓÓÒÏò×ó½ø¹¥µĶÓԱµÄ×ø±괦Àí - case 12: - if (m_iSide == LEFT_TO_RIGHT) { - op.position1.x = x; - op.position1.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) // Óҷ½һºŶÓԱ×ø±ê - { - r[0][0].position.x = x; - r[0][0].position.y = y; - r[0][0].angle = (int)angle; - } - break; - case 13: - if (m_iSide == LEFT_TO_RIGHT) { - op.position2.x = x; - op.position2.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][1].position.x = x; - r[0][1].position.y = y; - r[0][1].angle = (int)angle; - } - break; - case 14: - if (m_iSide == LEFT_TO_RIGHT) { - op.position3.x = x; - op.position3.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][2].position.x = x; - r[0][2].position.y = y; - r[0][2].angle = (int)angle; - } - break; - case 15: - if (m_iSide == LEFT_TO_RIGHT) { - op.position4.x = x; - op.position4.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][3].position.x = x; - r[0][3].position.y = y; - r[0][3].angle = (int)angle; - } - break; - case 16: - if (m_iSide == LEFT_TO_RIGHT) { - op.position5.x = x; - op.position5.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][4].position.x = x; - r[0][4].position.y = y; - r[0][4].angle = (int)angle; - } - break; - case 17: - if (m_iSide == LEFT_TO_RIGHT) { - op.position6.x = x; - op.position6.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][5].position.x = x; - r[0][5].position.y = y; - r[0][5].angle = (int)angle; - } - break; - case 18: - if (m_iSide == LEFT_TO_RIGHT) { - op.position7.x = x; - op.position7.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][6].position.x = x; - r[0][6].position.y = y; - r[0][6].angle = (int)angle; - } - break; - case 19: - if (m_iSide == LEFT_TO_RIGHT) { - op.position8.x = x; - op.position8.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][7].position.x = x; - r[0][7].position.y = y; - r[0][7].angle = (int)angle; - } - break; - case 20: - if (m_iSide == LEFT_TO_RIGHT) { - op.position9.x = x; - op.position9.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][8].position.x = x; - r[0][8].position.y = y; - r[0][8].angle = (int)angle; - } - break; - case 21: - if (m_iSide == LEFT_TO_RIGHT) { - op.position10.x = x; - op.position10.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][9].position.x = x; - r[0][9].position.y = y; - r[0][9].angle = (int)angle; - } - break; - case 22: - if (m_iSide == LEFT_TO_RIGHT) { - op.position11.x = x; - op.position11.y = y; - } - else if (m_iSide == RIGHT_TO_LEFT) { - r[0][10].position.x = x; - r[0][10].position.y = y; - r[0][10].angle = (int)angle; - } - break; - } - break; - case 'b': - case 'B': - theball.position.x = x; - theball.position.y = y; - break; - } - return TRUE; -} - -void CBaseAgent::SendCommand() { - CString msg; - if (m_iSide == LEFT_TO_RIGHT) { - msg.Format("((player left 1) %d %d) ((player left 2) %d %d) ((player left 3) %d %d) ((player left 4) %d %d) ((player left 5) %d %d) ((player left 6) %d %d) ((player left 7) %d %d) ((player left 8) %d %d) ((player left 9) %d %d) ((player left 10) %d %d) ((player left 11) %d %d)", - thePlannerL->command[2], thePlannerL->command[3], - thePlannerL->command[5], thePlannerL->command[6], - thePlannerL->command[8], thePlannerL->command[9], - thePlannerL->command[11], thePlannerL->command[12], - thePlannerL->command[14], thePlannerL->command[15], - thePlannerL->command[17], thePlannerL->command[18], - thePlannerL->command[20], thePlannerL->command[21], - thePlannerL->command[23], thePlannerL->command[24], - thePlannerL->command[26], thePlannerL->command[27], - thePlannerL->command[29], thePlannerL->command[30], - thePlannerL->command[32], thePlannerL->command[33]); - } - else if (m_iSide == RIGHT_TO_LEFT) { - msg.Format("((player right 1) %d %d) ((player right 2) %d %d) ((player right 3) %d %d) ((player right 4) %d %d) ((player right 5) %d %d) ((player right 6) %d %d) ((player right 7) %d %d) ((player right 8) %d %d) ((player right 9) %d %d) ((player right 10) %d %d) ((player right 11) %d %d)", - thePlannerR->command[2], thePlannerR->command[3], - thePlannerR->command[5], thePlannerR->command[6], - thePlannerR->command[8], thePlannerR->command[9], - thePlannerR->command[11], thePlannerR->command[12], - thePlannerR->command[14], thePlannerR->command[15], - thePlannerR->command[17], thePlannerR->command[18], - thePlannerR->command[20], thePlannerR->command[21], - thePlannerR->command[23], thePlannerR->command[24], - thePlannerR->command[26], thePlannerR->command[27], - thePlannerR->command[29], thePlannerR->command[30], - thePlannerR->command[32], thePlannerR->command[33]); - } - - SendMsg(msg); -} + +#include "stdafx.h" +#include "Agentsock.h" +#include +#include "MicroClientDoc.h" +#include "TParseString.h" +#include "StrategySystem.h" +#include "BaseAgent.h" +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#define new DEBUG_NEW +#endif +extern Robot2 r[2][11]; +extern Robot3 op; +extern Robot1 theball; +extern CStrategySystem *thePlannerR; +extern CStrategySystem *thePlannerL; + +// extern FILE* fp; +#define MAX_MSG_LENGTH 1500 +CBaseAgent::CBaseAgent() { + m_bConnected = FALSE; + m_iSide = LEFT_TO_RIGHT; + m_iNumber = 0; +} + +CBaseAgent::CBaseAgent(CMicroClientDoc *m_Doc) { + m_pDoc = m_Doc; + m_bConnected = FALSE; + m_iSide = LEFT_TO_RIGHT; + m_iNumber = 0; +} +CBaseAgent::~CBaseAgent() { + DisconnectAgent(); +} + +BOOL CBaseAgent::ConnectAgent(LPCTSTR lpszTeam, LPCTSTR lpszServer, UINT nPort) { + // is the agent already connected (should not happen) + if (m_bConnected) + return FALSE; + + // create the datagram socket + if (!Create(nPort, lpszServer)) { + // socket could not be created + OnErrorCreatingSocket(); + return FALSE; + } + else { + m_bConnected = TRUE; + m_strTeam = lpszTeam; + OnCreatedSocket(); + Sleep(100); + return TRUE; + } +} +void CBaseAgent::OnCreatedSocket() { + CString message; + + // send the (init team) command + message.Format("(init %s (version 4.00))", (LPCTSTR)m_strTeam); + SendMsg(message); +} + +void CBaseAgent::DisconnectAgent() { + // is the socket active ? + if (m_bConnected) { + BYTE Buffer[50]; + + ShutDown(); + while (Receive(Buffer, 50) > 0) + ; + Close(); + } + m_bConnected = FALSE; +} + +void CBaseAgent::SendMsg(CString &strText) { + int iLength; + + // send the buffer + iLength = SendTo(strText, strText.GetLength(), GetPort(), GetAddress(), 0); + if (iLength == strText.GetLength()) + OnSentMessage((LPCTSTR)strText); + else { +// an error occured +#ifdef _DEBUG + afxDump << "error writing to socket\n"; +#endif + OnErrorSendingMessage(); + } +} + +void CBaseAgent::OnReceive(int iError) { + char buffer[MAX_MSG_LENGTH]; + int iLength = 0; + UINT iPort = GetPort(); + int iPosition = 0; + + // first call base classes method + CAgentSocket::OnReceive(iError); + + // read a message from the socket + iLength = ReceiveFrom(buffer, MAX_MSG_LENGTH, GetAddress(), iPort, 0); + // the port may have changed + SetPort(iPort); + + if (iLength > 0) { + // OnReceivedMessage((LPCTSTR) buffer); + ParseMessage((LPCTSTR)buffer); + if (m_iSide == LEFT_TO_RIGHT) { + thePlannerL->ReceiveData(theball, r[0][0], r[0][1], r[0][2], r[0][3], r[0][4], + r[0][5], r[0][6], r[0][7], r[0][8], r[0][9], r[0][10], op); + thePlannerL->Action(); + } + else if (m_iSide == RIGHT_TO_LEFT) { + thePlannerR->ReceiveData(theball, r[0][0], r[0][1], r[0][2], r[0][3], r[0][4], + r[0][5], r[0][6], r[0][7], r[0][8], r[0][9], r[0][10], op); + thePlannerR->Action(); + } + SendCommand(); + } + else { +// an error occured +#ifdef _DEBUG + afxDump << "error reading socket\n"; +#endif + OnErrorReceivingMessage(); + } +} + +void CBaseAgent::ParseMessage(LPCTSTR str) { + switch (str[1]) { + case 's': + if (str[3] == 'e') + + ParseSee(str); + break; + case 'i': + AfxMessageBox("Init successful"); + ParseInit(str); + break; + } + // return TRUE; +} + +void CBaseAgent::ParseInit(LPCTSTR str) { + + TParseString msg(str); + CString tmp; + // int number; + + // get the side + if ((msg.GetLength() > 6) && (msg.GetAt(6) == 'r')) { + AfxMessageBox("right right"); + SetSide(RIGHT_TO_LEFT); + } + else { + SetSide(LEFT_TO_RIGHT); + } + + // return TRUE; +} + +void CBaseAgent::ParseSee(LPCTSTR str) { + TParseString msg(str); + TParseString strObject; + + msg.SetPosition(5); + m_iTime = msg.ParseInteger(); + if (msg.HasErrorOccured()) + return; + + while (msg.ParseBracket(strObject)) { + if (!ParseObject(strObject)) { +#ifdef _DEBUG + CString error; + error.Format(" : error parsing object info at position %d !\n", strObject.GetPosition()); + afxDump << error << strObject; +#endif + } + } +} + +BOOL CBaseAgent::ParseObject(LPCTSTR str) { + TParseString msg(str); + TParseString name; + CString teamname; + int team; + int iNum; + int x; + int y; + double angle; + + // read the objects name bracket + if (!msg.ParseBracket(name)) // name="player TeamName TeamNum" + return FALSE; + x = msg.ParseInteger(); + if (msg.HasErrorOccured()) { + } + y = msg.ParseInteger(); + if (msg.HasErrorOccured()) { + } + angle = msg.ParseDouble(); + if (msg.HasErrorOccured()) { + } + switch (name.GetAt(0)) { + // it is a player + case 'P': + case 'p': + name.SetPosition(7); + // read the teamname + if (name.ParseString(teamname)) { + // ist it my team ? + if (teamname.Compare(_T(name)) == 0) + team = OWN_TEAM; + else + team = OTHER_TEAM; + + // read player number + iNum = name.ParseInteger(); + if (msg.HasErrorOccured()) { + } + } + switch (iNum) { + case 1: + if (m_iSide == LEFT_TO_RIGHT) { + r[0][0].position.x = x; + r[0][0].position.y = y; + r[0][0].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position1.x = x; + op.position1.y = y; + } + break; + case 2: // ×󷽶þºŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][1].position.x = x; + r[0][1].position.y = y; + r[0][1].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position2.x = x; + op.position2.y = y; + } + break; + case 3: // ×ó·½ÈýºŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][2].position.x = x; + r[0][2].position.y = y; + r[0][2].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position3.x = x; + op.position3.y = y; + } + break; + case 4: // ×ó·½ËĺŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][3].position.x = x; + r[0][3].position.y = y; + r[0][3].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position4.x = x; + op.position4.y = y; + } + break; + case 5: // ×ó·½ÎåºŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][4].position.x = x; + r[0][4].position.y = y; + r[0][4].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position5.x = x; + op.position5.y = y; + } + break; + case 6: // ×ó·½ÁùºŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][5].position.x = x; + r[0][5].position.y = y; + r[0][5].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position6.x = x; + op.position6.y = y; + } + break; + case 7: // ×󷽯ߺŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][6].position.x = x; + r[0][6].position.y = y; + r[0][6].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position7.x = x; + op.position7.y = y; + } + break; + case 8: // ×󷽰˺ŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][7].position.x = x; + r[0][7].position.y = y; + r[0][7].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position8.x = x; + op.position8.y = y; + } + break; + case 9: // ×󷽾źŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][8].position.x = x; + r[0][8].position.y = y; + r[0][8].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position9.x = x; + op.position9.y = y; + } + break; + case 10: // ×ó·½ʮºŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][9].position.x = x; + r[0][9].position.y = y; + r[0][9].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position10.x = x; + op.position10.y = y; + } + break; + case 11: // ×ó·½ʮһºŶÓԱµÄ×ø±ê + if (m_iSide == LEFT_TO_RIGHT) { + r[0][10].position.x = x; + r[0][10].position.y = y; + r[0][10].angle = (int)angle; + } + else if (m_iSide == RIGHT_TO_LEFT) { + op.position11.x = x; + op.position11.y = y; + } + break; + // ÏÂÃæµÄÊǴÓÓÒÏò×ó½ø¹¥µĶÓԱµÄ×ø±괦Àí + case 12: + if (m_iSide == LEFT_TO_RIGHT) { + op.position1.x = x; + op.position1.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) // Óҷ½һºŶÓԱ×ø±ê + { + r[0][0].position.x = x; + r[0][0].position.y = y; + r[0][0].angle = (int)angle; + } + break; + case 13: + if (m_iSide == LEFT_TO_RIGHT) { + op.position2.x = x; + op.position2.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][1].position.x = x; + r[0][1].position.y = y; + r[0][1].angle = (int)angle; + } + break; + case 14: + if (m_iSide == LEFT_TO_RIGHT) { + op.position3.x = x; + op.position3.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][2].position.x = x; + r[0][2].position.y = y; + r[0][2].angle = (int)angle; + } + break; + case 15: + if (m_iSide == LEFT_TO_RIGHT) { + op.position4.x = x; + op.position4.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][3].position.x = x; + r[0][3].position.y = y; + r[0][3].angle = (int)angle; + } + break; + case 16: + if (m_iSide == LEFT_TO_RIGHT) { + op.position5.x = x; + op.position5.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][4].position.x = x; + r[0][4].position.y = y; + r[0][4].angle = (int)angle; + } + break; + case 17: + if (m_iSide == LEFT_TO_RIGHT) { + op.position6.x = x; + op.position6.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][5].position.x = x; + r[0][5].position.y = y; + r[0][5].angle = (int)angle; + } + break; + case 18: + if (m_iSide == LEFT_TO_RIGHT) { + op.position7.x = x; + op.position7.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][6].position.x = x; + r[0][6].position.y = y; + r[0][6].angle = (int)angle; + } + break; + case 19: + if (m_iSide == LEFT_TO_RIGHT) { + op.position8.x = x; + op.position8.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][7].position.x = x; + r[0][7].position.y = y; + r[0][7].angle = (int)angle; + } + break; + case 20: + if (m_iSide == LEFT_TO_RIGHT) { + op.position9.x = x; + op.position9.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][8].position.x = x; + r[0][8].position.y = y; + r[0][8].angle = (int)angle; + } + break; + case 21: + if (m_iSide == LEFT_TO_RIGHT) { + op.position10.x = x; + op.position10.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][9].position.x = x; + r[0][9].position.y = y; + r[0][9].angle = (int)angle; + } + break; + case 22: + if (m_iSide == LEFT_TO_RIGHT) { + op.position11.x = x; + op.position11.y = y; + } + else if (m_iSide == RIGHT_TO_LEFT) { + r[0][10].position.x = x; + r[0][10].position.y = y; + r[0][10].angle = (int)angle; + } + break; + } + break; + case 'b': + case 'B': + theball.position.x = x; + theball.position.y = y; + break; + } + return TRUE; +} + +void CBaseAgent::SendCommand() { + CString msg; + if (m_iSide == LEFT_TO_RIGHT) { + msg.Format("((player left 1) %d %d) ((player left 2) %d %d) ((player left 3) %d %d) ((player left 4) %d %d) ((player left 5) %d %d) ((player left 6) %d %d) ((player left 7) %d %d) ((player left 8) %d %d) ((player left 9) %d %d) ((player left 10) %d %d) ((player left 11) %d %d)", + thePlannerL->command[2], thePlannerL->command[3], + thePlannerL->command[5], thePlannerL->command[6], + thePlannerL->command[8], thePlannerL->command[9], + thePlannerL->command[11], thePlannerL->command[12], + thePlannerL->command[14], thePlannerL->command[15], + thePlannerL->command[17], thePlannerL->command[18], + thePlannerL->command[20], thePlannerL->command[21], + thePlannerL->command[23], thePlannerL->command[24], + thePlannerL->command[26], thePlannerL->command[27], + thePlannerL->command[29], thePlannerL->command[30], + thePlannerL->command[32], thePlannerL->command[33]); + } + else if (m_iSide == RIGHT_TO_LEFT) { + msg.Format("((player right 1) %d %d) ((player right 2) %d %d) ((player right 3) %d %d) ((player right 4) %d %d) ((player right 5) %d %d) ((player right 6) %d %d) ((player right 7) %d %d) ((player right 8) %d %d) ((player right 9) %d %d) ((player right 10) %d %d) ((player right 11) %d %d)", + thePlannerR->command[2], thePlannerR->command[3], + thePlannerR->command[5], thePlannerR->command[6], + thePlannerR->command[8], thePlannerR->command[9], + thePlannerR->command[11], thePlannerR->command[12], + thePlannerR->command[14], thePlannerR->command[15], + thePlannerR->command[17], thePlannerR->command[18], + thePlannerR->command[20], thePlannerR->command[21], + thePlannerR->command[23], thePlannerR->command[24], + thePlannerR->command[26], thePlannerR->command[27], + thePlannerR->command[29], thePlannerR->command[30], + thePlannerR->command[32], thePlannerR->command[33]); + } + + SendMsg(msg); +} diff --git a/DSetupDlg.cpp b/src/DSetupDlg.cpp similarity index 96% rename from DSetupDlg.cpp rename to src/DSetupDlg.cpp index 6b09a1a..5b85ae3 100644 --- a/DSetupDlg.cpp +++ b/src/DSetupDlg.cpp @@ -1,44 +1,44 @@ -// DSetupDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "MicroClient.h" -#include "DSetupDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// DSetupDlg dialog - -DSetupDlg::DSetupDlg(CWnd *pParent /*=NULL*/) - : CDialog(DSetupDlg::IDD, pParent) { - //{{AFX_DATA_INIT(DSetupDlg) - - //}}AFX_DATA_INIT - m_TeamName = _T("WTU-ATRI"); - m_ServerName = _T("127.0.0.1"); - m_Channel = 6000; -} - -void DSetupDlg::DoDataExchange(CDataExchange *pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(DSetupDlg) - - //}}AFX_DATA_MAP - // DDX_Text(pDX, IDC_TEAM, m_TeamName); - // DDX_Text(pDX, IDC_SERVER, m_ServerName); - // DDX_Text(pDX, IDC_CHANNEL, m_Channel); -} - -BEGIN_MESSAGE_MAP(DSetupDlg, CDialog) -//{{AFX_MSG_MAP(DSetupDlg) -// NOTE: the ClassWizard will add message map macros here -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DSetupDlg message handlers +// DSetupDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "MicroClient.h" +#include "DSetupDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// DSetupDlg dialog + +DSetupDlg::DSetupDlg(CWnd *pParent /*=NULL*/) + : CDialog(DSetupDlg::IDD, pParent) { + //{{AFX_DATA_INIT(DSetupDlg) + + //}}AFX_DATA_INIT + m_TeamName = _T("WTU-ATRI"); + m_ServerName = _T("127.0.0.1"); + m_Channel = 6000; +} + +void DSetupDlg::DoDataExchange(CDataExchange *pDX) { + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(DSetupDlg) + + //}}AFX_DATA_MAP + // DDX_Text(pDX, IDC_TEAM, m_TeamName); + // DDX_Text(pDX, IDC_SERVER, m_ServerName); + // DDX_Text(pDX, IDC_CHANNEL, m_Channel); +} + +BEGIN_MESSAGE_MAP(DSetupDlg, CDialog) +//{{AFX_MSG_MAP(DSetupDlg) +// NOTE: the ClassWizard will add message map macros here +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DSetupDlg message handlers diff --git a/MainFrm.cpp b/src/MainFrm.cpp similarity index 96% rename from MainFrm.cpp rename to src/MainFrm.cpp index 7e8db14..945d8ec 100644 --- a/MainFrm.cpp +++ b/src/MainFrm.cpp @@ -1,96 +1,96 @@ -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "MicroClient.h" - -#include "MainFrm.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame - -IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) -//{{AFX_MSG_MAP(CMainFrame) -// NOTE - the ClassWizard will add and remove mapping macros here. -// DO NOT EDIT what you see in these blocks of generated code ! -ON_WM_CREATE() -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -static UINT indicators[] = { - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, -}; - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame construction/destruction - -CMainFrame::CMainFrame() { - // TODO: add member initialization code here -} - -CMainFrame::~CMainFrame() { -} - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { - if (CFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || - !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { - TRACE0("Failed to create toolbar\n"); - return -1; // fail to create - } - - /* if (!m_wndStatusBar.Create(this) || - !m_wndStatusBar.SetIndicators(indicators, - sizeof(indicators)/sizeof(UINT))) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - }*/ - - // TODO: Delete these three lines if you don't want the toolbar to - // be dockable - m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); - EnableDocking(CBRS_ALIGN_ANY); - DockControlBar(&m_wndToolBar); - - return 0; -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs) { - if (!CFrameWnd::PreCreateWindow(cs)) - return FALSE; - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const { - CFrameWnd::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext &dc) const { - CFrameWnd::Dump(dc); -} - -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMainFrame message handlers +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "MicroClient.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) +//{{AFX_MSG_MAP(CMainFrame) +// NOTE - the ClassWizard will add and remove mapping macros here. +// DO NOT EDIT what you see in these blocks of generated code ! +ON_WM_CREATE() +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = { + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() { + // TODO: add member initialization code here +} + +CMainFrame::~CMainFrame() { +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { + if (CFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + /* if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + }*/ + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs) { + if (!CFrameWnd::PreCreateWindow(cs)) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const { + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext &dc) const { + CFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers diff --git a/MicroClient.cpp b/src/MicroClient.cpp similarity index 96% rename from MicroClient.cpp rename to src/MicroClient.cpp index 9f51d3d..ee63731 100644 --- a/MicroClient.cpp +++ b/src/MicroClient.cpp @@ -1,150 +1,150 @@ -// MicroClient.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "MicroClient.h" - -#include "MainFrm.h" -#include "MicroClientDoc.h" -#include "MicroClientView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientApp - -BEGIN_MESSAGE_MAP(CMicroClientApp, CWinApp) -//{{AFX_MSG_MAP(CMicroClientApp) -ON_COMMAND(ID_APP_ABOUT, OnAppAbout) -// NOTE - the ClassWizard will add and remove mapping macros here. -// DO NOT EDIT what you see in these blocks of generated code! -//}}AFX_MSG_MAP -// Standard file based document commands -ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) -ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientApp construction - -CMicroClientApp::CMicroClientApp() { - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CMicroClientApp object - -CMicroClientApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientApp initialization - -BOOL CMicroClientApp::InitInstance() { - if (!AfxSocketInit()) { - AfxMessageBox(IDP_SOCKETS_INIT_FAILED); - return FALSE; - } - - AfxEnableControlContainer(); - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. - -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif - - // Change the registry key under which our settings are stored. - // TODO: You should modify this string to be something appropriate - // such as the name of your company or organization. - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - - LoadStdProfileSettings(); // Load standard INI file options (including MRU) - - // Register the application's document templates. Document templates - // serve as the connection between documents, frame windows and views. - - CSingleDocTemplate *pDocTemplate; - pDocTemplate = new CSingleDocTemplate( - IDR_MAINFRAME, - RUNTIME_CLASS(CMicroClientDoc), - RUNTIME_CLASS(CMainFrame), // main SDI frame window - RUNTIME_CLASS(CMicroClientView)); - AddDocTemplate(pDocTemplate); - - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - - // Dispatch commands specified on the command line - if (!ProcessShellCommand(cmdInfo)) - return FALSE; - - // The one and only window has been initialized, so show and update it. - m_pMainWnd->ShowWindow(SW_SHOW); - m_pMainWnd->SetWindowText("WTU-ATRI"); - m_pMainWnd->UpdateWindow(); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialog { -public: - CAboutDlg(); - - // Dialog Data - //{{AFX_DATA(CAboutDlg) - enum { IDD = IDD_ABOUTBOX }; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CAboutDlg) -protected: - virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - // Implementation -protected: - //{{AFX_MSG(CAboutDlg) - // No message handlers - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { - //{{AFX_DATA_INIT(CAboutDlg) - //}}AFX_DATA_INIT -} - -void CAboutDlg::DoDataExchange(CDataExchange *pDX) { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CAboutDlg) - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -//{{AFX_MSG_MAP(CAboutDlg) -// No message handlers -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -// App command to run the dialog -void CMicroClientApp::OnAppAbout() { - CAboutDlg aboutDlg; - aboutDlg.DoModal(); -} - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientApp message handlers +// MicroClient.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "MicroClient.h" + +#include "MainFrm.h" +#include "MicroClientDoc.h" +#include "MicroClientView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientApp + +BEGIN_MESSAGE_MAP(CMicroClientApp, CWinApp) +//{{AFX_MSG_MAP(CMicroClientApp) +ON_COMMAND(ID_APP_ABOUT, OnAppAbout) +// NOTE - the ClassWizard will add and remove mapping macros here. +// DO NOT EDIT what you see in these blocks of generated code! +//}}AFX_MSG_MAP +// Standard file based document commands +ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) +ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientApp construction + +CMicroClientApp::CMicroClientApp() { + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CMicroClientApp object + +CMicroClientApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientApp initialization + +BOOL CMicroClientApp::InitInstance() { + if (!AfxSocketInit()) { + AfxMessageBox(IDP_SOCKETS_INIT_FAILED); + return FALSE; + } + + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Change the registry key under which our settings are stored. + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CSingleDocTemplate *pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + IDR_MAINFRAME, + RUNTIME_CLASS(CMicroClientDoc), + RUNTIME_CLASS(CMainFrame), // main SDI frame window + RUNTIME_CLASS(CMicroClientView)); + AddDocTemplate(pDocTemplate); + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The one and only window has been initialized, so show and update it. + m_pMainWnd->ShowWindow(SW_SHOW); + m_pMainWnd->SetWindowText("WTU-ATRI"); + m_pMainWnd->UpdateWindow(); + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog { +public: + CAboutDlg(); + + // Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) +protected: + virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + // Implementation +protected: + //{{AFX_MSG(CAboutDlg) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange *pDX) { + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +//{{AFX_MSG_MAP(CAboutDlg) +// No message handlers +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// App command to run the dialog +void CMicroClientApp::OnAppAbout() { + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientApp message handlers diff --git a/MicroClientDoc.cpp b/src/MicroClientDoc.cpp similarity index 96% rename from MicroClientDoc.cpp rename to src/MicroClientDoc.cpp index 79ed5ef..9a77532 100644 --- a/MicroClientDoc.cpp +++ b/src/MicroClientDoc.cpp @@ -1,116 +1,116 @@ -// MicroClientDoc.cpp : implementation of the CMicroClientDoc class -// - -#include "stdafx.h" -#include "MicroClient.h" -#include "BaseAgent.h" -#include "DSetupDlg.h" -#include "MicroClientDoc.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientDoc - -IMPLEMENT_DYNCREATE(CMicroClientDoc, CDocument) - -BEGIN_MESSAGE_MAP(CMicroClientDoc, CDocument) -//{{AFX_MSG_MAP(CMicroClientDoc) -ON_COMMAND(ID_CONNECT, OnConnect) -ON_UPDATE_COMMAND_UI(ID_CONNECT, OnUpdateConnect) -ON_COMMAND(ID_DISCONNECT, OnDisconnect) -ON_UPDATE_COMMAND_UI(ID_DISCONNECT, OnUpdateDisconnect) -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientDoc construction/destruction - -CMicroClientDoc::CMicroClientDoc() { - // TODO: add one-time construction code here -} - -CMicroClientDoc::~CMicroClientDoc() { - if (m_pAgent) - delete m_pAgent; -} - -BOOL CMicroClientDoc::OnNewDocument() { - if (!CDocument::OnNewDocument()) - return FALSE; - - // TODO: add reinitialization code here - // (SDI documents will reuse this document) - m_pAgent = new CBaseAgent(this); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientDoc serialization - -void CMicroClientDoc::Serialize(CArchive &ar) { - if (ar.IsStoring()) { - // TODO: add storing code here - } - else { - // TODO: add loading code here - } -} - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientDoc diagnostics - -#ifdef _DEBUG -void CMicroClientDoc::AssertValid() const { - CDocument::AssertValid(); -} - -void CMicroClientDoc::Dump(CDumpContext &dc) const { - CDocument::Dump(dc); -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientDoc commands - -void CMicroClientDoc::OnConnect() { - // TODO: Add your command handler code here - // m_pAgent->Connect(); - DSetupDlg Dialog; - - // ask the user for the name of the team and the server - Dialog.m_TeamName = _T("WTU-ATRI"); - Dialog.m_ServerName = _T("127.0.0.1"); - Dialog.m_Channel = 6000; - - // user can repeat with a different address while(TRUE) - { - - // try to connect - if (m_pAgent->ConnectAgent(Dialog.m_TeamName, Dialog.m_ServerName, Dialog.m_Channel)) - return; // TRUE; - if (Dialog.DoModal() != IDOK) - return; // FALSE; - } - m_pAgent->teamname = Dialog.m_TeamName; -} - -void CMicroClientDoc::OnUpdateConnect(CCmdUI *pCmdUI) { - // TODO: Add your command update UI handler code here - // pCmdUI-> -} - -void CMicroClientDoc::OnDisconnect() { - // TODO: Add your command handler code here - // fclose(fp); -} - -void CMicroClientDoc::OnUpdateDisconnect(CCmdUI *pCmdUI) { - // TODO: Add your command update UI handler code here - // pCmdUI-> -} +// MicroClientDoc.cpp : implementation of the CMicroClientDoc class +// + +#include "stdafx.h" +#include "MicroClient.h" +#include "BaseAgent.h" +#include "DSetupDlg.h" +#include "MicroClientDoc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientDoc + +IMPLEMENT_DYNCREATE(CMicroClientDoc, CDocument) + +BEGIN_MESSAGE_MAP(CMicroClientDoc, CDocument) +//{{AFX_MSG_MAP(CMicroClientDoc) +ON_COMMAND(ID_CONNECT, OnConnect) +ON_UPDATE_COMMAND_UI(ID_CONNECT, OnUpdateConnect) +ON_COMMAND(ID_DISCONNECT, OnDisconnect) +ON_UPDATE_COMMAND_UI(ID_DISCONNECT, OnUpdateDisconnect) +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientDoc construction/destruction + +CMicroClientDoc::CMicroClientDoc() { + // TODO: add one-time construction code here +} + +CMicroClientDoc::~CMicroClientDoc() { + if (m_pAgent) + delete m_pAgent; +} + +BOOL CMicroClientDoc::OnNewDocument() { + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + m_pAgent = new CBaseAgent(this); + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientDoc serialization + +void CMicroClientDoc::Serialize(CArchive &ar) { + if (ar.IsStoring()) { + // TODO: add storing code here + } + else { + // TODO: add loading code here + } +} + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientDoc diagnostics + +#ifdef _DEBUG +void CMicroClientDoc::AssertValid() const { + CDocument::AssertValid(); +} + +void CMicroClientDoc::Dump(CDumpContext &dc) const { + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientDoc commands + +void CMicroClientDoc::OnConnect() { + // TODO: Add your command handler code here + // m_pAgent->Connect(); + DSetupDlg Dialog; + + // ask the user for the name of the team and the server + Dialog.m_TeamName = _T("WTU-ATRI"); + Dialog.m_ServerName = _T("127.0.0.1"); + Dialog.m_Channel = 6000; + + // user can repeat with a different address while(TRUE) + { + + // try to connect + if (m_pAgent->ConnectAgent(Dialog.m_TeamName, Dialog.m_ServerName, Dialog.m_Channel)) + return; // TRUE; + if (Dialog.DoModal() != IDOK) + return; // FALSE; + } + m_pAgent->teamname = Dialog.m_TeamName; +} + +void CMicroClientDoc::OnUpdateConnect(CCmdUI *pCmdUI) { + // TODO: Add your command update UI handler code here + // pCmdUI-> +} + +void CMicroClientDoc::OnDisconnect() { + // TODO: Add your command handler code here + // fclose(fp); +} + +void CMicroClientDoc::OnUpdateDisconnect(CCmdUI *pCmdUI) { + // TODO: Add your command update UI handler code here + // pCmdUI-> +} diff --git a/MicroClientView.cpp b/src/MicroClientView.cpp similarity index 96% rename from MicroClientView.cpp rename to src/MicroClientView.cpp index e38ddd9..dfb895e 100644 --- a/MicroClientView.cpp +++ b/src/MicroClientView.cpp @@ -1,74 +1,74 @@ -// MicroClientView.cpp : implementation of the CMicroClientView class -// - -#include "stdafx.h" -#include "MicroClient.h" - -#include "MicroClientDoc.h" -#include "MicroClientView.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientView - -IMPLEMENT_DYNCREATE(CMicroClientView, CView) - -BEGIN_MESSAGE_MAP(CMicroClientView, CView) -//{{AFX_MSG_MAP(CMicroClientView) -// NOTE - the ClassWizard will add and remove mapping macros here. -// DO NOT EDIT what you see in these blocks of generated code! -//}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientView construction/destruction - -CMicroClientView::CMicroClientView() { - // TODO: add construction code here -} - -CMicroClientView::~CMicroClientView() { -} - -BOOL CMicroClientView::PreCreateWindow(CREATESTRUCT &cs) { - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs - - return CView::PreCreateWindow(cs); -} - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientView drawing - -void CMicroClientView::OnDraw(CDC *pDC) { - CMicroClientDoc *pDoc = GetDocument(); - ASSERT_VALID(pDoc); - // TODO: add draw code for native data here -} - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientView diagnostics - -#ifdef _DEBUG -void CMicroClientView::AssertValid() const { - CView::AssertValid(); -} - -void CMicroClientView::Dump(CDumpContext &dc) const { - CView::Dump(dc); -} - -CMicroClientDoc *CMicroClientView::GetDocument() // non-debug version is inline -{ - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMicroClientDoc))); - return (CMicroClientDoc *)m_pDocument; -} -#endif //_DEBUG - -///////////////////////////////////////////////////////////////////////////// -// CMicroClientView message handlers +// MicroClientView.cpp : implementation of the CMicroClientView class +// + +#include "stdafx.h" +#include "MicroClient.h" + +#include "MicroClientDoc.h" +#include "MicroClientView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientView + +IMPLEMENT_DYNCREATE(CMicroClientView, CView) + +BEGIN_MESSAGE_MAP(CMicroClientView, CView) +//{{AFX_MSG_MAP(CMicroClientView) +// NOTE - the ClassWizard will add and remove mapping macros here. +// DO NOT EDIT what you see in these blocks of generated code! +//}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientView construction/destruction + +CMicroClientView::CMicroClientView() { + // TODO: add construction code here +} + +CMicroClientView::~CMicroClientView() { +} + +BOOL CMicroClientView::PreCreateWindow(CREATESTRUCT &cs) { + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientView drawing + +void CMicroClientView::OnDraw(CDC *pDC) { + CMicroClientDoc *pDoc = GetDocument(); + ASSERT_VALID(pDoc); + // TODO: add draw code for native data here +} + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientView diagnostics + +#ifdef _DEBUG +void CMicroClientView::AssertValid() const { + CView::AssertValid(); +} + +void CMicroClientView::Dump(CDumpContext &dc) const { + CView::Dump(dc); +} + +CMicroClientDoc *CMicroClientView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMicroClientDoc))); + return (CMicroClientDoc *)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMicroClientView message handlers diff --git a/StdAfx.cpp b/src/StdAfx.cpp similarity index 91% rename from StdAfx.cpp rename to src/StdAfx.cpp index c48cd86..f4d3a78 100644 --- a/StdAfx.cpp +++ b/src/StdAfx.cpp @@ -1,17 +1,17 @@ -// stdafx.cpp : source file that includes just the standard includes -// MicroClient.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" -#include "StrategySystem.h" - -// °ѽÓÊյ½µĶÓԱµÄ×ø±êºͽǶȷÅÈër[0][i]ÀïÃ棬¶Է½¶ÓԱµÄ×ø±ê -// ·ÅÈëopÀïÃæ -// ȡÿ¸ö¶ÓԱµÄÂÖË٣¬ÔÚVelocityº¯Êý¼ÆËãÀïÃæÒѾ­»ñµÃÁËÈý -// ¸ö¶ÓԱµÄÂÖËÙ -int nKick; -CStrategySystem *thePlannerR = new CStrategySystem(0); -CStrategySystem *thePlannerL = new CStrategySystem(1); -Robot2 r[2][11]; -Robot3 op; // ´æ·ŶԷ½¶ÓԱµÄ×ø±êÊý¾Ý +// stdafx.cpp : source file that includes just the standard includes +// MicroClient.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" +#include "StrategySystem.h" + +// °ѽÓÊյ½µĶÓԱµÄ×ø±êºͽǶȷÅÈër[0][i]ÀïÃ棬¶Է½¶ÓԱµÄ×ø±ê +// ·ÅÈëopÀïÃæ +// ȡÿ¸ö¶ÓԱµÄÂÖË٣¬ÔÚVelocityº¯Êý¼ÆËãÀïÃæÒѾ­»ñµÃÁËÈý +// ¸ö¶ÓԱµÄÂÖËÙ +int nKick; +CStrategySystem *thePlannerR = new CStrategySystem(0); +CStrategySystem *thePlannerL = new CStrategySystem(1); +Robot2 r[2][11]; +Robot3 op; // ´æ·ŶԷ½¶ÓԱµÄ×ø±êÊý¾Ý Robot1 theball; // ´æ·ÅÇòµÄ×ø±êÊý¾Ý. \ No newline at end of file diff --git a/StrategySystem.cpp b/src/StrategySystem.cpp similarity index 96% rename from StrategySystem.cpp rename to src/StrategySystem.cpp index 675f9eb..551f42f 100644 --- a/StrategySystem.cpp +++ b/src/StrategySystem.cpp @@ -1,3104 +1,3104 @@ -#include "StdAfx.h" -#include "StrategySystem.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -IMPLEMENT_DYNAMIC(CStrategySystem, CObject) - -extern int nKick; -#define BALL_WIDTH 78 -#define BALL_LENGTH 156 -#define BALL_DIS 26 -#define CORNER 115 - -#define ANGLE_BOUND 60 -#define BOUND_BOUND 12 -#define G_OFFSET 20 -#define G_ANGLE_BOUND 60 -#define G_BOUND_BOUND 10 - -// 罚球 -void CStrategySystem::Penalty() { - srand(time(nullptr)); - int x = rand() % 2; - int d = 21; - static bool faceR; // 角度 - if (x) { - if (Distance(home1.position, ball.position) > d) { - Direction(HOME1, ball.position); - faceR = fabs(home1.angle) > 90; - } - else { - double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 505)))); // 求曲线行驶时轨迹的半径 - int lw = r / (r + 6) * 127; - if (faceR) - Velocity(1, lw, 127); - else - Velocity(1, -127, -lw); - } - } - else { - if (Distance(home1.position, ball.position) > d) { - Direction(HOME1, ball.position); - faceR = fabs(home1.angle) > 90; - } - else { - double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 313)))); - int rw = r / (r + 6) * 127; - if (!faceR) - Velocity(1, -rw, -127); - else - Velocity(1, 127, rw); - } - } - Direction(HOME2, ball.position); - Direction(HOME3, ball.position); - Direction(HOME4, ball.position); - Direction(HOME5, ball.position); - Direction(HOME6, ball.position); - Direction(HOME7, ball.position); - Direction(HOME8, ball.position); - Direction(HOME9, ball.position); - Direction(HOME10, ball.position); -} - -// 争球 -void CStrategySystem::Freeball() { - // 要实现先直冲,在曲线的话,就要加一个标识符标识此时的状态,当距离不足时标识符为1,距离够时标识符变为0,并且在争球结束后变为1 - // 感觉防御的话就直冲判断比较简单粗暴,毕竟目标是拦截,而不是射门, - static bool faceR; - int d = 25; - if (Status() == 2) { // 左上 - Direction(HOME3, ball.position); - Direction(HOME1, ball.position); - Direction(HOME2, ball.position); - Direction(HOME4, ball.position); - Direction(HOME5, ball.position); - Direction(HOME6, ball.position); - Direction(HOME7, ball.position); - Direction(HOME8, ball.position); - Direction(HOME9, ball.position); - Direction(HOME10, ball.position); - } - else if (Status() == 3) { // 左下 - Direction(HOME1, ball.position); - } - /* if (Status() == 2) { // 左上 - if (Distance(home3.position, ball.position) > d && flag) { - Direction(HOME3, CPoint(ball.position.x,ball.position.y-6)); - faceR = fabs(home3.angle) > 90; - } - else { - flag = false; - double r = Distance(home3.position, ball.position) / (2 * (sin(atwo(home3.pos.x, home3.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 605)))); // 求曲线行驶时轨迹的半径 - int lw = (r-5) / (r +8) * 127; - if (faceR) - Velocity(3, lw, 127); - else - Velocity(3, -127, -lw); - } - Direction(HOME1, ball.position); - Direction(HOME2, ball.position); - Direction(HOME4, ball.position); - Direction(HOME5, ball.position); - Direction(HOME6, ball.position); - Direction(HOME7, ball.position); - Direction(HOME8, ball.position); - Direction(HOME9, ball.position); - Direction(HOME10, ball.position); - } - - else if (Status() == 3) { // 左下 - if (Distance(home1.position, ball.position) > d && flag) { - Direction(HOME1, ball.position); - faceR = fabs(home1.angle) > 90; - } - else { - flag = false; - double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 213)))); - int rw = (r - 5) / (r + 8) * 127; - if (!faceR) - Velocity(1, -rw, -127); - else - Velocity(1, 127, rw); - } - Direction(HOME2, ball.position); - Direction(HOME3, ball.position); - Direction(HOME4, ball.position); - Direction(HOME5, ball.position); - Direction(HOME6, ball.position); - Direction(HOME7, ball.position); - Direction(HOME8, ball.position); - Direction(HOME9, ball.position); - Direction(HOME10, ball.position); - }*/ - else if (Status() == 4) { // 右上 - Direction(HOME10, ball.position); - } - /*else if (Status() == 4) { // 右上 - if (Distance(home10.position, ball.position) > d && flag) { - Direction(HOME10, ball.position); - faceR = fabs(home10.angle) > 90; - } - else { - flag = false; - double r = Distance(home10.position, ball.position) / (2 * (sin(atwo(home10.pos.x, home10.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 515, 95)))); - int rw = (r - 5) / (r + 5) * 127; - if (faceR) - Velocity(10, -rw, -127); - else - Velocity(10, 127, rw); - } - Direction(HOME1, ball.position); - Direction(HOME2, ball.position); - Direction(HOME3, ball.position); - Direction(HOME4, ball.position); - Direction(HOME5, ball.position); - Direction(HOME6, ball.position); - Direction(HOME7, ball.position); - Direction(HOME8, ball.position); - Direction(HOME9, ball.position); - } */ - /* else if (Status() == 5) { // 右下 - if (Distance(home7.position, ball.position) > d && flag) { - Direction(HOME7, ball.position); - faceR = fabs(home7.angle) > 90; - } - else { - flag = false; - double r = Distance(home7.position, ball.position) / (2 * (sin(atwo(home7.pos.x, home7.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 515, 723)))); - int lw = (r - 8) / (r + 5) * 127; - if (faceR) - Velocity(7, -127, -lw); - else - Velocity(7, lw, 127); - } - Direction(HOME1, ball.position); - Direction(HOME2, ball.position); - Direction(HOME3, ball.position); - Direction(HOME4, ball.position); - Direction(HOME5, ball.position); - Direction(HOME6, ball.position); - Direction(HOME8, ball.position); - Direction(HOME9, ball.position); - Direction(HOME10, ball.position); - }*/ - else if (Status() == 5) { // 右下//也许还有其它改进的思路,但实在南蚌 - Direction(HOME7, ball.position); - } - else // 这个标识符判断的问题到底咋搞,放在这的话应该是要在action函数里把freeball函数一直调用,如果要把还原放在action函数的话就要再不是争球的情况下都还原 - flag = 1; -} - -// 两直线间夹角 -double CStrategySystem::atwo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { - double j = 0; - double k1 = (y1 - y2) / (x1 - x2); - double k2 = (y3 - y4) / (x3 - x4); - j = atan(fabs((k2 - k1) / (1 + k1 * k2))); - return j; -} - -// void CStrategySystem::spin(int which, bool isClockwise) { // 自旋 -// if (isClockwise) -// Velocity(which, 127, -127); -// else -// Velocity(which, -127, 127); -// } - -// 控球 -// void CStrategySystem::Possession() { -// navigate(); -/*for(int i=1;i<11;i++) -{ - Navigation[i]=ball.position; -}*/ - -// if (ball.position.x < 290) { -// Canshot(); -// for (int i = 1; i < 9; i++) { -// control(i); -// } -// } -// else -// for (int i = 1; i < 11; i++) { -// control(i); -// } - -// bool a, b; -// if (ball.position.y >= 337 && ball.position.x < 290) // 球在敌方下半 -// { -// if ((ball.position.y >= 481 && ball.position.y <= 607) || (ball.position.x - ball.oldPosition.x <= 5 && ball.position.y - ball.oldPosition.y <= 5) && search1() < 4) // 7可射 -// shot(7, 1); // 7射 -// else -// control(7); - -// if (Distance(ball.position, home2.position) <= 75) // 2可射 -// { -// control(1); // 1 -// if (search1() < 4) -// shot(HOME2, 1); // 2射 -// else -// control(2); -// for (int i = 3; i < 7; i++) // 3-6 -// control(i); -// control(1); // 8 -// if (!canshot()) // 9,10 -// { -// control(9); -// control(10); -// } -// } -// else if (Distance(ball.position, home3.position) <= 75 && ball.position.y <= 481 && ball.position.y >= 505) // 3可射 -// { -// control(1); // 1 -// control(2); // 2 -// if (search1() < 4) -// shot(HOME3, 0); // 3射 -// else -// control(3); -// for (int i = 4; i < 7; i++) // 4-6 -// control(i); -// control(8); // 8 -// if (!canshot()) // 9,10 -// { -// control(9); -// control(10); -// } -// } -// else // 其它情况 -// for (int i = 1; i < 11; i++) // 1-10 -// control(i); -// } -// else if (ball.position.y < 481 && ball.position.x < 290) // 球在敌方上半 -// { -// if ((ball.position.y >= 217 && ball.position.y <= 337) || (ball.position.x - ball.oldPosition.x <= 5 && ball.position.y - ball.oldPosition.y <= 5) && search1() < 4) // 8可射 -// shot(8, 0); -// else -// control(8); -// if (Distance(ball.position, home3.position) <= 75) // 3可射 -// { -// control(1); // 1 -// control(2); // 2 -// if (search1() < 4) -// shot(HOME3, 0); // 3射 -// else -// control(3); -// for (int i = 4; i < 7; i++) // 4-6 -// control(i); -// control(HOME7); // 7 -// if (!canshot()) // 9,10 -// { -// control(9); -// control(10); -// } -// } -// else if (Distance(ball.position, home2.position) <= 75 && ball.position.y >= 313 && ball.position.y <= 337) // 2可射 -// { - -// control(1); // 1 -// if (search1() < 4) -// shot(2, 0); // 2射 -// else -// control(2); -// control(HOME3); // 3 -// for (int i = 4; i < 7; i++) // 4-6 -// control(i); -// control(HOME7); // 7 -// if (!canshot()) // 9,10 -// { -// control(9); -// control(10); -// } -// } -// else // 其它情况 -// for (int i = 1; i < 11; i++) // 1-10 -// control(i); -// } -// else // 其它情况 -// for (int i = 1; i < 11; i++) // 1-10 -// control(i); -//} - -// 控球具体实现 -void CStrategySystem::Possession() { - CPoint pos[10]; // pos[0] 中央球员;p[1:9] 阵型球员 - - RelPos rp[10]; // 阵型球员相对中央球员的位置 - for (int i = 0; i < 10; i++) - rp[i].id = i + 1; - - CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; - if (cp_id()) { - pos[0] = cur_pos[cp_id() - 1]; - - for (int i = 0; i < 10; i++) { - if (rp[i].id == cp_id()) { - rp[i].ang = 0; - rp[i].dis = 0; - } - else { - rp[i].ang = atan2(cur_pos[i].y - pos[0].y, cur_pos[i].x - pos[0].x); - rp[i].dis = Distance(cur_pos[i], pos[0]); - } - } - - RelPos r; - - // 孙徐 - if (fm_id() == 1) { - Direction(cp_id(), ball.position); - - pos[1] = CPoint(pos[0].x, pos[0].y - 20); - pos[2] = CPoint(pos[0].x + 20, pos[0].y - 20); - pos[3] = CPoint(pos[0].x + 20, pos[0].y); - pos[6] = CPoint(pos[0].x + 40, pos[0].y); - pos[4] = CPoint(pos[0].x + 20, pos[0].y + 20); - pos[7] = CPoint(pos[0].x + 40, pos[0].y + 20); - pos[5] = CPoint(pos[0].x + 20, pos[0].y + 40); - pos[8] = CPoint(170, 409); - pos[9] = CPoint(170, 556); - - fp_sort(rp); - fp_sort(rp, 0, 5); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - fp_sort(rp, 5, 7); - Direction(rp[6].id, pos[6]); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - else if (fm_id() == 2) { - Direction(cp_id(), ball.position); - - pos[1] = CPoint(pos[0].x, pos[0].y + 20); - pos[2] = CPoint(pos[0].x + 20, pos[0].y + 20); - pos[3] = CPoint(pos[0].x + 20, pos[0].y); - pos[6] = CPoint(pos[0].x + 40, pos[0].y); - pos[4] = CPoint(pos[0].x + 20, pos[0].y - 20); - pos[7] = CPoint(pos[0].x + 40, pos[0].y - 20); - pos[5] = CPoint(pos[0].x + 20, pos[0].y - 40); - pos[8] = CPoint(170, 409); - pos[9] = CPoint(170, 265); - - fp_sort(rp); - fp_sort(rp, 0, 5); - Direction(rp[5].id, pos[1]); - Direction(rp[4].id, pos[2]); - Direction(rp[3].id, pos[3]); - Direction(rp[2].id, pos[4]); - Direction(rp[1].id, pos[5]); - fp_sort(rp, 5, 7); - Direction(rp[6].id, pos[6]); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - else if (fm_id() == 3) { - if (ball.position.x >= 157 && ball.position.x <= 290 && ball.position.y <= 409) { - // 内圈 - pos[1] = CPoint(pos[0].x - 20, pos[0].y - 40); - pos[2] = CPoint(pos[0].x + 20, pos[0].y - 40); - pos[3] = CPoint(pos[0].x + 40 * cos(30), pos[0].y - 40 * sin(30)); - pos[4] = CPoint(pos[0].x + 40 * cos(30), pos[0].y + 40 * sin(40)); - pos[5] = CPoint(pos[0].x + 20, pos[0].y + 40); - pos[6] = CPoint(pos[0].x - 20, pos[0].y + 40); - // 内圈 - pos[7] = CPoint(pos[0].x + 120 * cos(67.5), pos[0].y - 120 * sin(67.5)); - pos[8] = CPoint(pos[0].x + 120 * cos(45), pos[0].y - 120 * sin(45)); - pos[9] = CPoint(pos[0].x + 120 * cos(22.5), pos[0].y - 120 * sin(22.5)); - shot(cp_id(), CPoint(45, 361)); - fp_sort(rp); - fp_sort(rp, 0, 6); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - fp_sort(rp, 5, 8); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - else if (ball.position.x >= 157 && ball.position.x <= 290 && ball.position.y > 409) { - // 内圈 - pos[1] = CPoint(pos[0].x - 20, pos[0].y - 40); - pos[2] = CPoint(pos[0].x + 20, pos[0].y - 40); - pos[3] = CPoint(pos[0].x + 40 * cos(30), pos[0].y - 40 * sin(30)); - pos[4] = CPoint(pos[0].x + 40 * cos(30), pos[0].y + 40 * sin(40)); - pos[5] = CPoint(pos[0].x + 20, pos[0].y + 40); - pos[6] = CPoint(pos[0].x - 20, pos[0].y + 40); - // 内圈 - pos[7] = CPoint(pos[0].x + 120 * cos(67.5), pos[0].y + 120 * sin(67.5)); - pos[8] = CPoint(pos[0].x + 120 * cos(45), pos[0].y + 120 * sin(45)); - pos[9] = CPoint(pos[0].x + 120 * cos(22.5), pos[0].y + 120 * sin(22.5)); - shot(cp_id(), CPoint(45, 457)); - fp_sort(rp); - fp_sort(rp, 0, 6); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - fp_sort(rp, 5, 8); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - else if (ball.position.x < 157 && ball.position.y >= 217 && ball.position.y <= 409) // 球在上半 - { - pos[1] = CPoint(142, pos[0].y - 20); - pos[2] = CPoint(142, pos[0].y + 20); - - pos[3] = CPoint(170, pos[0].y - 20); - pos[4] = CPoint(170, pos[0].y + 20); - pos[5] = CPoint(185, pos[0].y - 12); - if (pos[0].y - 50 < 157) - pos[6] = CPoint(ball.position.x + 12, 225); - else - pos[6] = CPoint(170, pos[0].y - 50); - pos[7] = CPoint(ball.position.x, 225); - pos[8] = CPoint(170, pos[0].y + 45); - pos[9] = CPoint(170, pos[0].y + 405); - shot(cp_id()); - fp_sort(rp, 0, 8); - Direction(rp[7].id, pos[1]); - Direction(rp[8].id, pos[2]); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[1].id, pos[6]); - Direction(rp[2].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - else if (ball.position.x < 157 && ball.position.y >= 217 && ball.position.y > 409) // 球在下半 - { - pos[1] = CPoint(142, pos[0].y - 20); - pos[2] = CPoint(142, pos[0].y + 20); - - pos[3] = CPoint(170, pos[0].y - 20); - pos[4] = CPoint(170, pos[0].y + 20); - pos[5] = CPoint(185, pos[0].y + 12); - if (pos[0].y + 50 > 607) - pos[6] = CPoint(ball.position.x + 12, 615); - else - pos[6] = CPoint(170, pos[0].y + 50); - pos[7] = CPoint(ball.position.x, 615); - pos[8] = CPoint(170, pos[0].y - 45); - pos[9] = CPoint(170, pos[0].y - 405); - shot(cp_id()); - fp_sort(rp, 0, 8); - Direction(rp[7].id, pos[1]); - Direction(rp[8].id, pos[2]); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[1].id, pos[6]); - Direction(rp[2].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - } - - // 王徐 - else if (fm_id() == 4) { - Direction(cp_id(), ball.position); - - pos[1] = CPoint(ball.position.x + (int)cos(45.0 * PI / 180.0) * 20, ball.position.y + (int)sin(45.0 * PI / 180.0) * 20); - pos[2] = CPoint(ball.position.x + (int)cos(90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(90.0 * PI / 180.0) * 20); - pos[3] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); - pos[4] = CPoint(pos[0].x + (int)cos(15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(15.0 * PI / 180.0) * 40); - pos[5] = CPoint(pos[0].x + (int)cos(30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(30.0 * PI / 180.0) * 40); - pos[6] = CPoint(pos[0].x + (int)cos(45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(45.0 * PI / 180.0) * 40); - pos[7] = CPoint(pos[0].x + (int)cos(50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(50.0 * PI / 180.0) * 60); - pos[8] = CPoint(pos[0].x + (int)cos(60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(60.0 * PI / 180.0) * 60); - pos[9] = CPoint(pos[0].x + (int)cos(75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(75.0 * PI / 180.0) * 60); - - fp_sort(rp); - fp_sort(rp, 0, 2); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 2, 6); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - fp_sort(rp, 6, 9); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - - /*double d[10], dy[10]; - CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; - for (int i = 0; i <= 9; i++) { - if (i == cp_id() - 1) { - d[i] = 1e5; - } - else { - d[i] = Distance(cur_pos[i], cur_pos[cp_id() - 1]); - } - } - int p1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - for (int i = 1; i <= 10; i++) { - for (int j = 0; j < 10 - i; j++) { - if (d[j] > d[j + 1]) { - int tmp = d[j]; - d[j] = d[j + 1]; - d[j + 1] = tmp; - tmp = p1[j]; - p1[j] = p1[j + 1]; - p1[j + 1] = tmp; - } - } - } - Direction(p1[0], pos[0]); - Direction(p1[1], pos[1]); - for (int i = 0; i <= 9; i++) { - if (i == cp_id() - 1) { - dy[i] = 1e5; - } - else { - dy[p1[i]] = 217 - cur_pos[i].y; - } - } - dy[p1[0]] = 1e5; - dy[p1[1]] = 1e5; - int p2[10] = { p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9] }; - for (int i = 1; i <= 10; i++) { - for (int j = 0; j < 10 - i; j++) { - if (dy[j] > dy[j + 1]) { - int tmp = d[j]; - dy[j] = dy[j + 1]; - dy[j + 1] = tmp; - tmp = p2[j]; - p2[j] = p2[j + 1]; - p2[j + 1] = tmp; - } - } - } - Direction(p2[0], pos[9]); - Direction(p2[1], pos[8]); - Direction(p2[2], pos[7]); - Direction(p2[3], pos[6]); - Direction(p2[4], pos[5]); - Direction(p2[5], pos[4]); - Direction(p2[6], pos[3]);*/ - } - else if (fm_id() == 5) { - Direction(cp_id(), ball.position); - - pos[2] = CPoint(ball.position.x + (int)cos(0.0 * PI / 180.0) * 20, ball.position.y + (int)sin(0.0 * PI / 180.0) * 20); - pos[1] = CPoint(ball.position.x + (int)cos(-90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(-90.0 * PI / 180.0) * 20); - pos[6] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); - pos[5] = CPoint(pos[0].x + (int)cos(-15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-15.0 * PI / 180.0) * 40); - pos[4] = CPoint(pos[0].x + (int)cos(-30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-30.0 * PI / 180.0) * 40); - pos[3] = CPoint(pos[0].x + (int)cos(-45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(6 - 45.0 * PI / 180.0) * 40); - pos[9] = CPoint(pos[0].x + (int)cos(-50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-50.0 * PI / 180.0) * 60); - pos[8] = CPoint(pos[0].x + (int)cos(-60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-60.0 * PI / 180.0) * 60); - pos[7] = CPoint(pos[0].x + (int)cos(-75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-75.0 * PI / 180.0) * 60); - - fp_sort(rp); - fp_sort(rp, 0, 2); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 2, 6); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - fp_sort(rp, 6, 9); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - - // double d[10], dy[10]; // dy是球员新的 - // CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; - // for (int i = 0; i <= 9; i++) { - // if (i == cp_id() - 1) { - // d[i] = 1e5; - // } - // else { - // d[i] = Distance(cur_pos[i], cur_pos[cp_id() - 1]); - // } - // } - // int p1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // p1是球员新下标 - // for (int i = 1; i <= 10; i++) { - // for (int j = 0; j < 10 - i; j++) { - // if (d[j] > d[j + 1]) { - // // 根据球员与中心球员距离,按从小到大排列距离 - // int tmp = d[j]; - // d[j] = d[j + 1]; - // d[j + 1] = tmp; - - // // 距离交换后,下标同时交换 - // tmp = p1[j]; - // p1[j] = p1[j + 1]; - // p1[j + 1] = tmp; - // } - // } - //} - // Direction(p1[0], pos[0]); - // Direction(p1[1], pos[1]); - // for (int i = 0; i <= 9; i++) { - // if (i == cp_id() - 1) { - // dy[i] = 1e5; - // } - // else { - // dy[p1[i]] = cur_pos[i].y - 607; - // } - //} - // dy[p1[0]] = 1e5; - // dy[p1[1]] = 1e5; - //// p2 - // int p2[10] = { p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9] }; - // for (int i = 1; i <= 10; i++) { - // for (int j = 0; j < 10 - i; j++) { - // if (dy[j] > dy[j + 1]) { - // int tmp = d[j]; - // dy[j] = dy[j + 1]; - // dy[j + 1] = tmp; - - // // 距离交换后,下标同时交换 - // tmp = p2[j]; - // p2[j] = p2[j + 1]; - // p2[j + 1] = tmp; - // } - // } - //} - // Direction(p2[0], pos[9]); - // Direction(p2[1], pos[8]); - // Direction(p2[2], pos[7]); - // Direction(p2[3], pos[6]); - // Direction(p2[4], pos[5]); - // Direction(p2[5], pos[4]); - // Direction(p2[6], pos[3]); - } - else if (fm_id() == 6) { - Direction(cp_id(), ball.position); - - pos[1] = CPoint(ball.position.x + (int)cos(-90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(-90.0 * PI / 180.0) * 20); - pos[2] = CPoint(ball.position.x + (int)cos(90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(90.0 * PI / 180.0) * 20); - pos[5] = CPoint(pos[0].x + (int)cos(45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(45.0 * PI / 180.0) * 40); - pos[3] = CPoint(pos[0].x + (int)cos(-45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-45.0 * PI / 180.0) * 40); - pos[4] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); - pos[9] = CPoint(pos[0].x + (int)cos(60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(60.0 * PI / 180.0) * 60); - pos[6] = CPoint(pos[0].x + (int)cos(-60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-60.0 * PI / 180.0) * 60); - pos[8] = CPoint(pos[0].x + (int)cos(30.0 * PI / 180.0) * 60, pos[0].y + (int)sin(30.0 * PI / 180.0) * 60); - pos[7] = CPoint(pos[0].x + (int)cos(-30.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-30.0 * PI / 180.0) * 60); - - fp_sort(rp); - fp_sort(rp, 0, 2); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 2, 5); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - fp_sort(rp, 5, 9); - Direction(rp[6].id, pos[6]); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - - /*int d[10]; - CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; - for (int i = 0; i <= 9; i++) { - if (i == cp_id() - 1) { - d[i] = 1e5; - } - d[i] = cur_pos[i].x - cur_pos[cp_id() - 1].x; - } - int p[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - for (int i = 1; i <= 10; i++) { - int j; - for (j = 0; j < 10 - i; j++) { - if (d[j] > d[j + 1]) { - int tmp = d[j]; - d[j] = d[j + 1]; - d[j + 1] = tmp; - tmp = p[j]; - p[j] = p[j + 1]; - p[j + 1] = tmp; - } - } - } - for (int i = 0; i <= 9; i++) { - if (p[i] = cp_id() - 1) - continue; - Direction(p[i], pos[i + 1]); - }*/ - } - // 景缪 - else if (fm_id() == 7) { - Direction(cp_id(), ball.position); - - if (ball.position.x > 873) { - pos[1] = CPoint(pos[0].x + 20, pos[0].y - 15); - pos[2] = CPoint(pos[0].x + 20, pos[0].y + 15); - pos[3] = CPoint(pos[0].x + 10, pos[0].y + 30); - pos[4] = CPoint(pos[0].x - 20, pos[0].y + 20); - pos[5] = CPoint(pos[0].x + 20, pos[0].y - 30); - pos[6] = CPoint(pos[0].x - 40, pos[0].y + 20); - pos[7] = CPoint(896, 217); - pos[8] = CPoint(919, 217); - pos[9] = CPoint(942, 217); - } - else { - pos[1] = CPoint(pos[0].x, pos[0].y - 20); - pos[2] = CPoint(pos[0].x + 10, pos[0].y + 20); - pos[3] = CPoint(pos[0].x - 25, pos[0].y + 30); - pos[4] = CPoint(pos[0].x - 40, pos[0].y + 30); - pos[5] = CPoint(pos[0].x + 10, pos[0].y + 50); - pos[6] = CPoint(pos[0].x + 50, pos[0].y - 10); - int n1 = 643 > ball.position.x ? 623 : ball.position.x; - int n2 = 733 > ball.position.x ? 733 : ball.position.x; - pos[7] = CPoint(n1, 217); - pos[8] = CPoint(n2, 217); - pos[9] = CPoint(939, 217); - } - - fp_sort(rp); - fp_sort(rp, 0, 2); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 2, 6); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - fp_sort(rp, 6, 9); - PositionSE(rp[7].id, pos[7]); - PositionSE(rp[8].id, pos[8]); - PositionSE(rp[9].id, pos[9]); - - // double adou[15]; - // int xz[15]; - // int n = 1; - // xz[n] = cp_id(); - // int pp[15]; - // for (int i = 1; i <= 9; i++) // 按角度从小到大排序,然后最小的占据点位,并且后续将已分配的记名,不参与接下来的分配 - // { - // for (int u = 1; u <= 10; u++) { - // Robot2 *robot; - // switch (u) { - // case HOME1: - // robot = &home1; - // break; - // case HOME2: - // robot = &home2; - // break; - // case HOME3: - // robot = &home3; - // break; - // case HOME4: - // robot = &home4; - // break; - // case HOME5: - // robot = &home5; - // break; - // case HOME6: - // robot = &home6; - // break; - // case HOME7: - // robot = &home7; - // break; - // case HOME8: - // robot = &home8; - // break; - // case HOME9: - // robot = &home9; - // break; - // case HOME10: - // robot = &home10; - // break; - // } - // adou[u] = atwo(robot->position.x, robot->position.y, ball.position.x, ball.position.y, pos[i].x, pos[i].y, ball.position.x, ball.position.y); // 先将值赋给adou - // pp[u] = u; - // } - - // // 然后求adou里最小的,给pos[1]的坐标,并将球员号计入xz中 - // for (int u = 1; u <= 10; u++) - // for (int j = u + 1; j <= 10; j++) - // if (adou[u] > adou[j]) { - // double t; - // int m; - // m = pp[u]; - // pp[u] = pp[j]; - // pp[j] = m; - // t = adou[u]; - // adou[u] = adou[j]; - // adou[j] = t; - // } - // for (int u = 1; u <= 10; u++) { - // int o = 0; - // for (int j = 1; j <= n; j++) { - // if (pp[u] == xz[j]) // 是记录人员 - // { - // break; - // } - // if (j == n) // 不是记录人员 - // { - // Direction(pp[u], pos[i]); - // n++; - // xz[n] = pp[u]; - // o = 1; - // } - // } - // if (o == 1) - // break; - // } - // } - // // if (Distance(pos[i], ball.position)<5) - // // PositionSE(pos[i], ball.position); // 在这个阵型这个点位处的球员就击球 - // // 否则就保持一定速度在点位待机 - } - else if (fm_id() == 8) { - Direction(cp_id(), ball.position); - - if (ball.position.x > 873) { - pos[1] = CPoint(pos[0].x + 20, pos[0].y + 15); - pos[2] = CPoint(pos[0].x + 20, pos[0].y - 15); - pos[3] = CPoint(pos[0].x + 20, pos[0].y - 30); - pos[4] = CPoint(pos[0].x - 20, pos[0].y - 20); - pos[5] = CPoint(pos[0].x + 20, pos[0].y + 30); - pos[6] = CPoint(pos[0].x - 40, pos[0].y - 20); - pos[7] = CPoint(896, 608); - pos[8] = CPoint(919, 608); - pos[9] = CPoint(942, 608); - } - else { - pos[1] = CPoint(pos[0].x, pos[0].y + 20); - pos[2] = CPoint(pos[0].x + 10, pos[0].y - 20); - pos[6] = CPoint(pos[0].x - 25, pos[0].y - 30); - pos[5] = CPoint(pos[0].x - 40, pos[0].y - 30); - pos[4] = CPoint(pos[0].x + 10, pos[0].y - 50); - pos[3] = CPoint(pos[0].x + 50, pos[0].y + 10); - int n1 = 643 > ball.position.x ? 643 : ball.position.x; - int n2 = 733 > ball.position.x ? 733 : ball.position.x; - pos[7] = CPoint(n1, 608); - pos[8] = CPoint(n2, 608); - pos[9] = CPoint(939, 608); - } - - fp_sort(rp); - fp_sort(rp, 0, 2); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 2, 6); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - fp_sort(rp, 6, 9); - PositionSE(rp[7].id, pos[7]); - PositionSE(rp[8].id, pos[8]); - PositionSE(rp[9].id, pos[9]); - // double adou[15]; - // int xz[15]; - // int n = 1; - // xz[n] = cp_id(); - // int pp[15]; - // for (int i = 1; i <= 9; i++) // 按角度从小到大排序,然后最小的占据点位,并且后续将已分配的记名,不参与接下来的分配 - // { - - // for (int u = 1; u <= 10; u++) { - // Robot2 *robot; - // switch (u) { - // case HOME1: - // robot = &home1; - // break; - // case HOME2: - // robot = &home2; - // break; - // case HOME3: - // robot = &home3; - // break; - // case HOME4: - // robot = &home4; - // break; - // case HOME5: - // robot = &home5; - // break; - // case HOME6: - // robot = &home6; - // break; - // case HOME7: - // robot = &home7; - // break; - // case HOME8: - // robot = &home8; - // break; - // case HOME9: - // robot = &home9; - // break; - // case HOME10: - // robot = &home10; - // break; - // } - // adou[u] = atwo(robot->position.x, robot->position.y, ball.position.x, ball.position.y, pos[i].x, pos[i].y, ball.position.x, ball.position.y); // 先将值赋给adou - // pp[u] = u; - // } - // // 然后求adou里最小的,给pos[1]的坐标,并将球员号计入xz中 - // for (int u = 1; u <= 10; u++) - // for (int j = u + 1; j <= 10; j++) - // if (adou[u] > adou[j]) { - // double t; - // int m; - // m = pp[u]; - // pp[u] = pp[j]; - // pp[j] = m; - // t = adou[u]; - // adou[u] = adou[j]; - // adou[j] = t; - // } - // for (int u = 1; u <= 10; u++) { - // int o = 0; - // for (int j = 1; j <= n; j++) { - // if (pp[u] == xz[j]) // 是记录人员 - // { - // break; - // } - // if (j == n) // 不是记录人员 - // { - // Direction(pp[u], pos[i]); - // n++; - // xz[n] = pp[u]; - // o = 1; - // } - // } - // if (o == 1) - // break; - // } - // } - // // if (Distance(pos[i], ball.position)<5) - // // PositionSE(pos[i], ball.position);//在这个阵型这个点位处的球员就击球 - // // 否则就保持一定速度在点位待机 - } - else if (fm_id() == 9) { - Direction(cp_id(), ball.position); - if (ball.position.y > 409) { - pos[1].y = pos[0].y - 35; - pos[1].x = pos[0].x - 10; - pos[2].y = pos[0].y - 25; - pos[2].x = pos[0].x + 30; - pos[3].y = pos[0].y; - pos[3].x = pos[0].x + 30; - pos[4].y = pos[0].y - 65; - pos[4].x = pos[0].x; - pos[5].y = pos[0].y - 75; - pos[5].x = pos[0].x + 60; - pos[6].y = pos[0].y - 60; - pos[6].x = pos[0].x + 70; - pos[7].y = pos[0].y + 20; - pos[7].x = pos[0].x + 70; - pos[8].y = pos[0].y + 60; - pos[8].x = pos[0].x + 70; - pos[9].y = pos[0].y - 90; - pos[9].x = pos[0].x + 07; - } - else if (ball.position.y <= 409) { - pos[1].y = pos[0].y; - pos[1].x = pos[0].x + 30; - pos[2].y = pos[0].y + 35; - pos[2].x = pos[0].x - 40; - pos[3].y = pos[0].y + 25; - pos[3].x = pos[0].x; - pos[4].y = pos[0].y + 65; - pos[4].x = pos[0].x + 70; - pos[5].y = pos[0].y + 75; - pos[5].x = pos[0].x + 60; - pos[6].y = pos[0].y + 65; - pos[6].x = pos[0].x + 70; - pos[7].y = pos[0].y + 20; - pos[7].x = pos[0].x + 70; - pos[8].y = pos[0].y - 20; - pos[8].x = pos[0].x + 70; - pos[9].y = pos[0].y + 90; - pos[9].x = pos[0].x + 70; - } - if (ball.position.x >= 800) { // 球临近禁区 - fp_sort(rp); - fp_sort(rp, 0, 3); - PositionSE(rp[1].id, pos[1]); - PositionSE(rp[2].id, pos[2]); - PositionSE(rp[3].id, pos[3]); - fp_sort(rp, 3, 8); - PositionSE(rp[4].id, pos[4]); - PositionSE(rp[5].id, pos[5]); - PositionSE(rp[6].id, pos[6]); - PositionSE(rp[7].id, pos[7]); - PositionSE(rp[8].id, pos[8]); - fp_sort(rp, 8, 9); - PositionSE(rp[9].id, pos[9]); - } - else { - fp_sort(rp); - fp_sort(rp, 0, 3); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - Direction(rp[3].id, pos[3]); - fp_sort(rp, 3, 8); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - Direction(rp[6].id, pos[6]); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - fp_sort(rp, 8, 9); - Direction(rp[9].id, pos[9]); - } - } - } - else { // TODO 无中央球员 - if (fm_id() == 4 || fm_id() == 6) { - pos[0] = CPoint(ball.position.x + (int)cos(0 * PI / 180) * 40, ball.position.y + (int)sin(20 * PI / 180) * 40); - pos[1] = CPoint(ball.position.x + (int)cos(45.0 * PI / 180.0) * 20, ball.position.y + (int)sin(45.0 * PI / 180.0) * 20); - pos[2] = CPoint(ball.position.x + (int)cos(90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(90.0 * PI / 180.0) * 20); - pos[3] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); - pos[4] = CPoint(pos[0].x + (int)cos(15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(15.0 * PI / 180.0) * 40); - pos[5] = CPoint(pos[0].x + (int)cos(30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(30.0 * PI / 180.0) * 40); - pos[6] = CPoint(pos[0].x + (int)cos(45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(45.0 * PI / 180.0) * 40); - pos[7] = CPoint(pos[0].x + (int)cos(50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(50.0 * PI / 180.0) * 60); - pos[8] = CPoint(pos[0].x + (int)cos(60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(60.0 * PI / 180.0) * 60); - pos[9] = CPoint(pos[0].x + (int)cos(75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(75.0 * PI / 180.0) * 60); - - fp_sort(rp); - fp_sort(rp, 0, 3); - Direction(rp[0].id, pos[0]); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 3, 6); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - fp_sort(rp, 6, 10); - Direction(rp[6].id, pos[6]); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - else if (fm_id() == 5) { - pos[0] = CPoint(ball.position.x + (int)cos(0 * PI / 180) * 40, ball.position.y - (int)sin(20 * PI / 180) * 40); - pos[1] = CPoint(ball.position.x + (int)cos(0.0 * PI / 180.0) * 20, ball.position.y + (int)sin(0.0 * PI / 180.0) * 20); - pos[2] = CPoint(ball.position.x + (int)cos(-90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(-90.0 * PI / 180.0) * 20); - pos[3] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); - pos[4] = CPoint(pos[0].x + (int)cos(-15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-15.0 * PI / 180.0) * 40); - pos[5] = CPoint(pos[0].x + (int)cos(-30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-30.0 * PI / 180.0) * 40); - pos[6] = CPoint(pos[0].x + (int)cos(-45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-45.0 * PI / 180.0) * 40); - pos[7] = CPoint(pos[0].x + (int)cos(-50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-50.0 * PI / 180.0) * 60); - pos[8] = CPoint(pos[0].x + (int)cos(-60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-60.0 * PI / 180.0) * 60); - pos[9] = CPoint(pos[0].x + (int)cos(-75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-75.0 * PI / 180.0) * 60); - - fp_sort(rp); - fp_sort(rp, 0, 3); - Direction(rp[0].id, pos[0]); - Direction(rp[1].id, pos[1]); - Direction(rp[2].id, pos[2]); - fp_sort(rp, 3, 6); - Direction(rp[3].id, pos[3]); - Direction(rp[4].id, pos[4]); - Direction(rp[5].id, pos[5]); - fp_sort(rp, 6, 10); - Direction(rp[6].id, pos[6]); - Direction(rp[7].id, pos[7]); - Direction(rp[8].id, pos[8]); - Direction(rp[9].id, pos[9]); - } - } -} - -// 搜索最近球员位置 -// CPoint CStrategySystem::searchNear(int which) { -// CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; -// double ddd = 10000; -// CPoint near; -// for (int i = 0; i < 10; i++) { -// if (Distance(cur_pos[i], ball.position) < ddd) { -// ddd = Distance(cur_pos[i], ball.position); -// near = cur_pos[i]; -// } -// } -// return near; -// } - -// 中央球员 ID -int CStrategySystem::cp_id() { - int id = 0; - CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; - if (fm_id() == 1) { - for (int i = 0; i < 10; i++) { - if (cur_pos[i].y >= ball.position.y) - cur_pos[i] = CPoint(-965, -723); - } - double min = 10000; - for (int i = 0; i < 10; i++) { - if (Distance(cur_pos[i], ball.position) < min) { - min = Distance(cur_pos[i], ball.position); - id = i + 1; - } - } - } - else if (fm_id() == 2) { - for (int i = 0; i < 10; i++) { - if (cur_pos[i].y <= ball.position.y) - cur_pos[i] = CPoint(-965, -723); - } - double min = 10000; - for (int i = 0; i < 10; i++) { - if (Distance(cur_pos[i], ball.position) < min) { - min = Distance(cur_pos[i], ball.position); - id = i + 1; - } - } - } - else if (fm_id() == 7) { - for (int i = 0; i < 10; i++) { - if (cur_pos[i].y <= ball.position.y) - cur_pos[i] = CPoint(-965, -723); - } - double min = 10000; - for (int i = 0; i < 10; i++) { - if (Distance(cur_pos[i], ball.position) < min) { - min = Distance(cur_pos[i], ball.position); - id = i + 1; - } - } - } - else if (fm_id() == 8) { - for (int i = 0; i < 10; i++) { - if (cur_pos[i].y >= ball.position.y) - cur_pos[i] = CPoint(-965, -723); - } - double min = 10000; - for (int i = 0; i < 10; i++) { - if (Distance(cur_pos[i], ball.position) < min) { - min = Distance(cur_pos[i], ball.position); - id = i + 1; - } - } - } - else if (fm_id() == 3) { - if (ball.position.x >= 157 && ball.position.x <= 290) { - for (int i = 0; i < 10; i++) { - if (cur_pos[i].x < ball.position.x) - cur_pos[i] = CPoint(-965, -723); - } - double min = 10000; - for (int i = 0; i < 10; i++) { - if (Distance(cur_pos[i], ball.position) < min) { - min = Distance(cur_pos[i], ball.position); - id = i + 1; - } - } - } - else if (ball.position.x >= 65 && ball.position.x < 157) // 球在禁区用y轴最近 - { - double min = 10000; - for (int i = 0; i < 10; i++) { - if (cur_pos[i].x < ball.position.x) - cur_pos[i] = CPoint(-965, -723); - } - for (int i = 0; i < 10; i++) { - if (fabs(ball.position.y - cur_pos[i].y) < min) { - min = fabs(ball.position.y - cur_pos[i].y); - id = i + 1; - } - } - } - } - else { - for (int i = 0; i < 10; i++) { - if (cur_pos[i].x <= ball.position.x) - cur_pos[i] = CPoint(-965, -723); - } - double min = 10000; - for (int i = 0; i < 10; i++) { - if (Distance(cur_pos[i], ball.position) < min) { - min = Distance(cur_pos[i], ball.position); - id = i + 1; - } - } - } - return id; -} - -// 阵型 ID -int CStrategySystem::fm_id() { - if (ball.position.x < 290) { - if (ball.position.y < 217) - return 1; - else if (ball.position.y <= 607) - return 3; - else - return 2; - } - else if (ball.position.x < 740) { - if (ball.position.y < 217) - return 4; - else if (ball.position.y <= 607) - return 6; - else - return 5; - } - else { - if (ball.position.y < 217) - return 7; - else if (ball.position.y <= 607) - return 9; - else - return 8; - } -} - -// 阵型球员相对中央球员的位置结构体 -// struct RelPos { -// int id; -// double dis; -// double ang; // (-π, π] -// }; - -// 阵型球员排序,h 为该层前的球员数量,t 为包含该层后的球员数量 -void CStrategySystem::fp_sort(RelPos *rp, int h, int t) { - RelPos r; - if (!h && !t) { - for (int i = 1; i < 10; i++) { - for (int j = 0; j < 10 - i; j++) { - if (rp[j].dis > rp[j + 1].dis) { - r = rp[j], rp[j] = rp[j + 1], rp[j + 1] = r; - } - } - } - } - else { - for (int i = h + 1; i < t; i++) { - for (int j = h; j < t - i; j++) { - if (rp[j].ang > rp[j + 1].ang) { - r = rp[j], rp[j] = rp[j + 1], rp[j + 1] = r; - } - } - } - } -} - -// 返回机器人的位置 -CPoint CStrategySystem::coor(int which) { - Robot2 *robot; - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - return robot->position; -} - -// 0向下门框射 -void CStrategySystem::shot(int which) { - Robot2 *robot; - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - bool de; - if (ball.position.y > robot->position.y) - de = 0; - else - de = 1; - double O, O1; - CPoint t1, t2, t3, t4; // t1球,t2机器人,t3机器人要移动到的点,t4门 - t1.x = ball.position.x; - t1.y = ball.position.y; - if (de == 0) { - t4.x = 33.0; - t4.y = 505.0; - O = atan(fabs(ball.position.y - t4.y) / fabs(ball.position.x - t4.x)); // fabs(Angle(,t4)); - O1 = 180 - O; - t3.x = t1.x + cos(O) * 34; - t3.y = t1.y - sin(O) * 34; - } - else if (de == 1) { - t4.x = 33.0; - t4.y = 313.0; - O = atan(fabs(ball.position.y - t4.y) / fabs(ball.position.x - t4.x)); // fabs(Angle(ball.position,t4)); - O1 = 180 + O; - t3.x = t1.x + cos(O) * 34; - t3.y = t1.y + sin(O) * 34; - } - if (Distance(robot->position, ball.position) <= 35 && (fabs(Angle(ball.position, t3) - Angle(robot->position, t3))) <= 2) { - if (de == 1) { - t3.x = t1.x - cos(O) * 34; - t3.y = t1.y - sin(O) * 34; - Direction(which, t3); - } - else if (de == 0) { - t3.x = t1.x - cos(O) * 34; - t3.y = t1.y + sin(O) * 34; - Direction(which, t3); - } - } - else - Position(which, t3); // 机器人到足够近的点t3 -} - -// 射? -bool CStrategySystem::canshot() { - bool t; // 判断球在敌方上半还是下半;0为下半 - CPoint D1, D2, t4; - Robot2 *robot9, *robot10; - robot9 = &home9; - robot10 = &home10; - // if (ball.position.y >= 409 && ball.position.x <= 290&&ball.position.y<=607) // 球在敌方下半 - // { - // t = 0; - // D1.x = 170; - // D1.y = 265; - // Position(HOME10, D1); - // D2.x = 170; - // D2.y = 409; - // Position(HOME9, D2); - // } - // else if (ball.position.y < 409 && ball.position.x < 290 && ball.position.y >= 217 && Distance(ball.position, home10.position) > 168) // 球在敌方上半 - // { - // t = 1; - // D1.x = 170; - // D1.y = 556; - // Position(HOME10, D1); - // D2.x = 170; - // D2.y = 409; - // Position(HOME9, D2); - // if (ball.position.x >= 104 && ball.position.x <= 170 && ball.position.y >= 313 && ball.position.y <= 449 && (ball.oldPosition.y - ball.oldPosition.y) <= 0) - // Shot(HOME9, 1); - // if (ball.position.x >= 104 && ball.position.x <= 170 && ball.position.y > 449 && ball.position.y <= 607 && (ball.oldPosition.y - ball.oldPosition.y) <= 0) - // Shot(HOME10, 1); - // } - if (ball.position.y <= 481) // 敌方框上半场 - { - D1.x = 170; - D1.y = 265; - D2.x = 170; - D2.y = 409; - if (Distance(ball.position, home9.position) <= 116 && ball.position.y >= 409 && ball.position.y <= 481) // 9可射 - { - shot(HOME9, 0); - Direction(HOME10, D1); - } - else if (Distance(ball.position, home10.position) <= 168 && ball.position.y < 409 && ball.position.y >= 265) // 10可射 - { - Direction(HOME9, D2); - shot(HOME10, 0); - } - else { // 9,10到预定位置 - Direction(HOME10, D1); - Direction(HOME9, D2); - } - return 1; - } - else if (ball.position.y >= 337) // 敌方框下半场 - { - D1.x = 170; - D1.y = 556; - D2.x = 170; - D2.y = 409; - if (Distance(ball.position, home9.position) <= 116 && ball.position.y <= 409 && ball.position.y >= 337) // 9可射 - { - shot(HOME9, 1); - Direction(HOME10, D1); - } - else if (Distance(ball.position, home10.position) <= 164 && ball.position.y > 409 && ball.position.y <= 556) // 10可射 - { - Direction(HOME9, D2); - shot(HOME10, 1); - } - else { // 9,10到预定位置 - Direction(HOME10, D1); - Direction(HOME9, D2); - } - return 1; - } - return 0; - // if () - // { - // if (ball.position.y <= 170) { - // Position(HOME10, D1); - // Shot(HOME9, 0); - // } - // else if (ball.position.y >= 170) { - // Position(HOME9, D2); - // Shot(HOME10, 0); - // } - // } - // else { - // Position(HOME10, D1); - // Position(HOME9, D2); - // } -} - -// 把球向t点射,de向上还是向下射 -void CStrategySystem::shot(int which, CPoint t) { - Robot2 *robot; - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - bool de; - if (ball.position.y > robot->position.y) - de = 0; - else - de = 1; - double O; - CPoint t1, t2, t3; // t1球,t2机器人,t3机器人要移动到的点 - t1.x = ball.position.x; - t1.y = ball.position.y; - if (de == 0) { - O = atan(fabs(ball.position.y - t.y) / fabs(ball.position.x - t.x)); - if (ball.position.x <= 515) { - t3.x = t1.x + cos(O) * 34; - t3.y = t1.y - sin(O) * 34; - } - else { - t3.x = t1.x - cos(O) * 34; - t3.y = t1.y - sin(O) * 34; - } - } - else if (de == 1) { - O = atan(fabs(ball.position.y - t.y) / fabs(ball.position.x - t.x)); // fabs(Angle(ball.position,t4)); - if (ball.position.x <= 515) { - t3.x = t1.x + cos(O) * 34; - t3.y = t1.y + sin(O) * 34; - } - else { - t3.x = t1.x - cos(O) * 34; - t3.y = t1.y + sin(O) * 34; - } - } - if (Distance(robot->position, ball.position) <= 35 && (fabs(Angle(ball.position, t3) - Angle(robot->position, t3))) <= 2) { - if (de == 1) { - t3.x = t1.x - cos(O) * 34; - t3.y = t1.y - sin(O) * 34; - Direction(which, t3); - } - else if (de == 0) { - t3.x = t1.x - cos(O) * 34; - t3.y = t1.y + sin(O) * 34; - Direction(which, t3); - } - } - else - Position(which, t3); // 机器人到足够近的点t3 -} - -// 直射 -void CStrategySystem::shot1(int which, double o, CPoint t) { - Robot2 *robot; - switch (which) { - case HOME9: - robot = &home9; - break; - case HOME1: - robot = &home1; - break; - } - bool a = 0; - /*if((fabs(Angle(ball.position, t) - Angle(robot->position, t))) > 5)*/ - Angle(which, o); - Velocity(which, 127, 127); // which全速前进 -} - -/*void banarea(int which) //让9,10不进禁区 -{ - Robot2 *robot; - switch (which) { - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - } - CPoint t1, t2;//t1球 - t1.x = ball.position.x; - t1.y = ball.position.y; - t2.x = robot->position.x; - t2.y = robot->position.y; - if((t1.x>=65&&1.x<=103&&t1.y>=247&&t1.y<=577)||(t2.x+1==)) -}*/ - -// void CStrategySystem::navigate() // 给人要去的位置坐标导航(预判) -// { -// CPoint robot[11]; -// robot[1] = home1.position; -// robot[2] = home2.position; -// robot[3] = home3.position; -// robot[4] = home4.position; -// robot[5] = home5.position; -// robot[6] = home6.position; -// robot[7] = home7.position; -// robot[8] = home8.position; -// robot[9] = home9.position; -// robot[10] = home10.position; -// /*double d[11]; -// d[1] = Distance(ball.position, home1.position); -// d[2] = Distance(ball.position, home2.position); -// d[3] = Distance(ball.position, home3.position); -// d[4] = Distance(ball.position, home4.position); -// d[5] = Distance(ball.position, home5.position); -// d[6] = Distance(ball.position, home6.position); -// d[7] = Distance(ball.position, home7.position); -// d[8] = Distance(ball.position, home8.position); -// d[9] = Distance(ball.position, home9.position); -// d[10] = Distance(ball.position, home10.position);*/ -// if (65 < ball.position.x && ball.position.x <= 515) { - -// // 对方罚球区内,包围门框 -// if (ball.position.x <= 160 && ball.position.y <= 600 && ball.position.y >= 210) { - -// Navigation[1] = CPoint(175, ball.position.y); -// Navigation[2] = CPoint(175, ball.position.y + 20); -// Navigation[3] = CPoint(175, ball.position.y - 20); -// Navigation[4] = CPoint(200, ball.position.y); -// Navigation[5] = CPoint(175, ball.position.y + 30); -// Navigation[6] = CPoint(200, ball.position.y - 30); -// Navigation[7] = CPoint(ball.position.x, 610); -// Navigation[8] = CPoint(ball.position.x, 210); -// Navigation[9] = CPoint(220, ball.position.y + 50); -// Navigation[10] = CPoint(220, ball.position.y - 50); -// } -// // 对方下半场 -// else if (ball.position.y >= 607) { -// if (home1.position.x > ball.position.x) { // 球员在右 -// if (home1.position.y > ball.position.y) { // 球员在右下 -// Navigation[1] = ball.position; -// } -// else { // 球员在右下 -// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y + 10); -// } -// } -// else { // 球员在左 -// if (home1.position.y > ball.position.y) { // 左下 -// Navigation[1] = ball.position; -// } -// else { // 左上 -// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y + 10); -// } -// } -// if (home2.position.x > ball.position.x) { -// if (home2.position.y > ball.position.y) { -// Navigation[2] = ball.position; -// } -// else { -// Navigation[2] = CPoint(ball.position.x + 10, ball.position.y + 20); -// } -// } -// else { -// if (home2.position.y > ball.position.y) { -// Navigation[2] = ball.position; -// } -// else { -// Navigation[2] = CPoint(ball.position.x - 10, ball.position.y - 20); -// } -// } -// if (home3.position.x > ball.position.x) { -// if (home3.position.y > ball.position.y) { -// Navigation[3] = ball.position; -// } -// else { -// Navigation[3] = CPoint(ball.position.x + 20, ball.position.y + 10); -// } -// } -// else { -// if (home3.position.y > ball.position.y) { -// Navigation[3] = ball.position; -// } -// else { -// Navigation[3] = CPoint(ball.position.x - 20, ball.position.y - 10); -// } -// } -// Navigation[4] = CPoint(ball.position.x + 50, ball.position.y + 50); -// Navigation[5] = CPoint(ball.position.x + 50, ball.position.y); -// Navigation[6] = CPoint(ball.position.x + 50, ball.position.y - 50); -// Navigation[7] = CPoint(ball.position.x, ball.position.y + 50); -// Navigation[8] = CPoint(ball.position.x - 50, ball.position.y + 50); -// Navigation[9] = CPoint(ball.position.x + 80, ball.position.y); -// Navigation[10] = CPoint(ball.position.x + 80, ball.position.y + 50); -// //// Navigate(ball.position); -// //// 机器人在球右下 -// // if (robot->position.y <= ball.position.y && robot->position.x >= ball.position.x) { -// // Direction(which, ball.position); -// // // Velocity(which, 127, 127); -// // } -// //// 机器人在球右上 -// // else if (robot->position.y > ball.position.y && robot->position.x > ball.position.x) { -// // Direction(which, CPoint(ball.position.x + 10, ball.position.y)); -// // // Velocity(which, vL, vR); -// // } -// //// 机器人在球左上 -// // else if (robot->position.y < ball.position.y && robot->position.x < ball.position.x) { -// // // Position(which, CPoint(ball.)); -// // } -// //// 机器人在球左下 -// // else { -// // Direction(which, CPoint(ball.position.x - 20, ball.position.y)); -// // } -// } -// // 对方中场 -// else if (ball.position.y >= 217 && ball.position.y < 607) { -// if (home1.position.x > ball.position.x) { -// if (home1.position.y < ball.position.y) { -// Navigation[1] = ball.position; -// } -// else { -// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y - 10); -// } -// } -// else { -// if (home1.position.y < ball.position.y) { -// Navigation[1] = CPoint(ball.position.x, ball.position.y - 10); -// } -// else { -// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y - 10); -// } -// } -// if (home2.position.x > ball.position.x) { -// if (home2.position.y < ball.position.y) { -// Navigation[2] = ball.position; -// } -// else { -// Navigation[2] = CPoint(ball.position.x + 20, ball.position.y + 10); -// } -// } -// else { -// if (home2.position.y < ball.position.y) { -// Navigation[1] = CPoint(ball.position.x, ball.position.y - 15); -// } -// else { -// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y - 15); -// } -// } -// if (home3.position.x > ball.position.x) { -// if (home3.position.y < ball.position.y) { -// Navigation[3] = ball.position; -// } -// else { -// Navigation[3] = CPoint(ball.position.x + 10, ball.position.y + 20); -// } -// } -// else { -// if (home3.position.y < ball.position.y) { -// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y - 15); -// } -// else { -// Navigation[1] = CPoint(ball.position.x - 15, ball.position.y - 10); -// } -// } -// Navigation[4] = CPoint(ball.position.x, ball.position.y - 60); -// Navigation[5] = CPoint(ball.position.x + 50, ball.position.y - 60); -// Navigation[6] = CPoint(ball.position.x + 60, ball.position.y - 50); -// Navigation[7] = CPoint(ball.position.x + 60, ball.position.y + 50); -// Navigation[8] = CPoint(ball.position.x + 60, ball.position.y + 70); -// Navigation[9] = CPoint(ball.position.x + 70, ball.position.y - 60); -// Navigation[10] = CPoint(ball.position.x + 70, ball.position.y - 60); -// //// 机器人在球的右下 -// // if (robot->position.x >= ball.position.x && robot->position.y <= ball.position.y) { -// // Direction(which, ball.position); -// // } -// //// 机器人在球右上 -// // else if (robot->position.x > ball.position.x && robot->position.y > ball.position.y) { -// // // 右上且距离较远 -// // if (robot->position.y >= ball.position.y + 100) { -// // Direction(which, CPoint(ball.position.x + 20, ball.position.y + 20)); -// // } -// // // 距离较近 -// // else { -// // Direction(which, CPoint(ball.position.x + 10, ball.position.y)); -// // } -// // } -// //// 机器人在球左下 -// // else if (robot->position.x <= ball.position.x && robot->position.y >= ball.position.y) { -// // Direction(which, CPoint(ball.position.x - 20, ball.position.y + 20)); -// // } -// //// 机器人在球左上 -// // else { -// // Direction(which, CPoint(ball.position.x - 20, ball.position.y - 20)); -// // } -// } -// // 上场 -// else { -// if (home1.position.x > ball.position.x) { -// if (home1.position.y < ball.position.y) { -// Navigation[1] = ball.position; -// } -// else { -// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y - 10); -// } -// } -// else { -// if (home1.position.y < ball.position.y) { -// Navigation[1] = CPoint(ball.position.x, ball.position.y - 10); -// } -// else { -// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y - 10); -// } -// } -// if (home2.position.x > ball.position.x) { -// if (home2.position.y < ball.position.y) { -// Navigation[2] = ball.position; -// } -// else { -// Navigation[2] = CPoint(ball.position.x + 10, ball.position.y); -// } -// } -// else { -// if (home2.position.y < ball.position.y) { -// Navigation[2] = CPoint(ball.position.x - 5, ball.position.y - 10); -// } -// else { -// Navigation[2] = CPoint(ball.position.x - 10, ball.position.y - 10); -// } -// } -// if (home3.position.x > ball.position.x) { -// if (home3.position.y < ball.position.y) { -// Navigation[3] = ball.position; -// } -// else { -// Navigation[3] = CPoint(ball.position.x + 10, ball.position.y - 15); -// } -// } -// else { -// if (home2.position.y < ball.position.y) { -// Navigation[3] = CPoint(ball.position.x - 5, ball.position.y - 10); -// } -// else { -// Navigation[3] = CPoint(ball.position.x - 10, ball.position.y - 10); -// } -// } -// Navigation[4] = CPoint(ball.position.x - 50, ball.position.y - 50); -// Navigation[5] = CPoint(ball.position.x, ball.position.y - 50); -// Navigation[6] = CPoint(ball.position.x + 50, ball.position.y - 50); -// Navigation[7] = CPoint(ball.position.x + 50, ball.position.y); -// Navigation[8] = CPoint(ball.position.x + 60, ball.position.y + 50); -// Navigation[9] = CPoint(ball.position.x + 70, ball.position.y + 60); -// Navigation[10] = CPoint(ball.position.x + 70, ball.position.y + 70); -// // 机器人在球右上 -// // if (robot->position.x >= ball.position.x && robot->position.y <= ball.position.y) { -// // Direction(which, ball.position); -// //} -// //// 机器人在球右下 -// // else if (robot->position.x >= ball.position.x && robot->position.y > ball.position.y) { -// // Direction(which, CPoint(ball.position.x + 20, ball.position.y)); -// // } -// //// 机器人在球左上 -// // else if (robot->position.x < ball.position.x && robot->position.y >= ball.position.y) { -// // Direction(which, CPoint(ball.position.x - 20, ball.position.y)); -// // } -// //// 机器人在左下 -// // else { -// // } -// } -// } -// // 防守区域(在己方罚球区外) -// else if (ball.position.x > 515 && ball.position.x < 965) { -// CPoint goal; -// double l; - -// // 己方上半场 -// goal.x = ball.position.x; -// goal.y = 95; -// l = Distance(ball.position, goal); -// if (ball.position.y < 217 && ball.position.y >= 95) { -// Navigation[1].x = ball.position.x; -// Navigation[1].y = 95 + (int)l + 5; -// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[2].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[4].x = ball.position.x; -// Navigation[4].y = 95 + (int)l + 15; -// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[5].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[9].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// } -// // 己方中场 -// else if (ball.position.y > 217 && ball.position.y <= 607) { -// // 球在中场上侧,要把球往上压 -// if (ball.position.y < 409) { -// Navigation[1].x = ball.position.x; -// Navigation[1].y = 95 + (int)l + 5; -// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[2].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[4].x = ball.position.x; -// Navigation[4].y = 95 + (int)l + 15; -// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[5].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[9].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// } -// // 球在中场下侧,要把球往下压 - -// else { -// goal.x = ball.position.x; -// goal.y = 723; -// l = Distance(ball.position, goal); -// Navigation[1].x = ball.position.x; -// Navigation[1].y = 723 - (int)l - 5; -// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[2].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[4].x = ball.position.x; -// Navigation[4].y = 723 - (int)l - 15; -// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[5].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[9].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// } -// } -// // 己方下半场 - -// else if (ball.position.y > 607) { -// goal.x = ball.position.x; -// goal.y = 723; -// l = Distance(ball.position, goal); -// Navigation[1].x = ball.position.x; -// Navigation[1].y = 723 - (int)l - 5; -// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[2].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[3].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); -// Navigation[4].x = ball.position.x; -// Navigation[4].y = 723 - (int)l - 15; -// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[5].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[6].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[7].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[8].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); -// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[9].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); -// Navigation[10].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); -// } -// } -// for (int i = 1; i < 11; i++) // 己方禁区处理 -// { -// int kx, ky, x1, x2; -// if (Navigation[i].x > 873 && Navigation[i].y < 607 && Navigation[i].y > 217) // 导航定位不进禁区 -// { -// if (ball.position.x > 873) { -// if (ball.position.y > 607) -// Navigation[i].y = 607; -// if (ball.position.y < 217) -// Navigation[i].y = 217; -// } -// else { -// Navigation[i].x = 873; -// } -// } -// else if (Navigation[i].x > 873 && Navigation[i].y > 607) // 行走路径不进禁区 -// { -// if (robot[i].x < 873 && robot[i].y < 607 && robot[i].y > 217) { -// ky = abs((Navigation[i].y - robot[i].y) / (Navigation[i].x - robot[i].x)); -// x1 = abs((873 - robot[i].x) * ky); -// x2 = abs(607 - robot[i].y); -// if (x2 > x1) { -// Navigation[i].y = robot[i].y + x1; -// Navigation[i].x = 873; -// } -// } -// } -// else if (Navigation[i].x > 873 && Navigation[i].y < 217) { -// if (robot[i].x < 873 && robot[i].y < 607 && robot[i].y > 217) { -// ky = abs((Navigation[i].y - robot[i].y) / (Navigation[i].x - robot[i].x)); -// x1 = abs((873 - robot[i].x) * ky); -// x2 = abs(217 - robot[i].y); -// if (x2 > x1) { -// Navigation[i].y = robot[i].y - x1; -// Navigation[i].x = 873; -// } -// } -// } -// else if (Navigation[i].x < 873 && Navigation[i].y > 217) { -// if (robot[i].x > 873 && robot[i].y < 217) { -// kx = abs((Navigation[i].x - robot[i].x) / (Navigation[i].y - robot[i].y)); -// x1 = abs((217 - robot[i].y) * kx); -// x2 = abs(873 - robot[i].x); -// if (x2 > x1) { -// Navigation[i].y = 217; -// Navigation[i].x = robot[i].x - x1; -// } -// } -// } -// else if (Navigation[i].x < 873 && Navigation[i].y < 607) { -// if (robot[i].x > 873 && robot[i].y > 607) { -// kx = abs((Navigation[i].x - robot[i].x) / (Navigation[i].y - robot[i].y)); -// x1 = abs((607 - robot[i].y) * kx); -// x2 = abs(873 - robot[i].x); -// if (x2 > x1) { -// Navigation[i].y = 607; -// Navigation[i].x = robot[i].x - x1; -// } -// } -// } -// } -// } - -// void CStrategySystem::control(int which) { -// Robot2 *robot; -// // switch (which) { -// // case HOME1: -// // robot = &home1; -// // break; -// // case HOME2: -// // robot = &home2; -// // break; -// // case HOME3: -// // robot = &home3; -// // break; -// // case HOME4: -// // robot = &home4; -// // break; -// // case HOME5: -// // robot = &home5; -// // break; -// // case HOME6: -// // robot = &home6; -// // break; -// // case HOME7: -// // robot = &home7; -// // break; -// // case HOME8: -// // robot = &home8; -// // break; -// // case HOME9: -// // robot = &home9; -// // break; -// // case HOME10: -// // robot = &home10; -// // break; -// // case HGOALIE: -// // robot = &hgoalie; -// // break; -// // } -// PositionSE(which, Navigation[which]); -// } - -// 查找在大区里的机器人 -int CStrategySystem::search1() { - int sum = 0; - if ((home1.position.x >= 105 && home1.position.x <= 157 && home1.position.y >= 247 && home1.position.y <= 577) || (home1.position.x >= 65 && home1.position.x <= 157 && home1.position.y >= 217 && home1.position.y <= 247) || (home1.position.x >= 65 && home1.position.x <= 157 && home1.position.y >= 577 && home1.position.y <= 607)) - sum++; - if ((home2.position.x >= 105 && home2.position.x <= 157 && home2.position.y >= 247 && home2.position.y <= 577) || (home2.position.x >= 65 && home2.position.x <= 157 && home2.position.y >= 217 && home2.position.y <= 247) || (home2.position.x >= 65 && home2.position.x <= 157 && home2.position.y >= 577 && home2.position.y <= 607)) - sum++; - if ((home3.position.x >= 105 && home3.position.x <= 157 && home3.position.y >= 247 && home3.position.y <= 577) || (home3.position.x >= 65 && home3.position.x <= 157 && home3.position.y >= 217 && home3.position.y <= 247) || (home3.position.x >= 65 && home3.position.x <= 157 && home3.position.y >= 577 && home3.position.y <= 607)) - sum++; - if ((home4.position.x >= 105 && home4.position.x <= 157 && home4.position.y >= 247 && home4.position.y <= 577) || (home4.position.x >= 65 && home4.position.x <= 157 && home4.position.y >= 217 && home4.position.y <= 247) || (home4.position.x >= 65 && home4.position.x <= 157 && home4.position.y >= 577 && home4.position.y <= 607)) - sum++; - if ((home5.position.x >= 105 && home5.position.x <= 157 && home5.position.y >= 247 && home5.position.y <= 577) || (home5.position.x >= 65 && home5.position.x <= 157 && home5.position.y >= 217 && home5.position.y <= 247) || (home5.position.x >= 65 && home5.position.x <= 157 && home5.position.y >= 577 && home5.position.y <= 607)) - sum++; - if ((home6.position.x >= 105 && home6.position.x <= 157 && home6.position.y >= 247 && home6.position.y <= 577) || (home6.position.x >= 65 && home6.position.x <= 157 && home6.position.y >= 217 && home6.position.y <= 247) || (home6.position.x >= 65 && home6.position.x <= 157 && home6.position.y >= 577 && home6.position.y <= 607)) - sum++; - if ((home7.position.x >= 105 && home7.position.x <= 157 && home7.position.y >= 247 && home7.position.y <= 577) || (home7.position.x >= 65 && home7.position.x <= 157 && home7.position.y >= 217 && home7.position.y <= 247) || (home7.position.x >= 65 && home7.position.x <= 157 && home7.position.y >= 577 && home7.position.y <= 607)) - sum++; - if ((home8.position.x >= 105 && home8.position.x <= 157 && home8.position.y >= 247 && home8.position.y <= 577) || (home8.position.x >= 65 && home8.position.x <= 157 && home8.position.y >= 217 && home8.position.y <= 247) || (home8.position.x >= 65 && home8.position.x <= 157 && home8.position.y >= 577 && home8.position.y <= 607)) - sum++; - if ((home9.position.x >= 105 && home9.position.x <= 157 && home9.position.y >= 247 && home9.position.y <= 577) || (home9.position.x >= 65 && home9.position.x <= 157 && home9.position.y >= 217 && home9.position.y <= 247) || (home9.position.x >= 65 && home9.position.x <= 157 && home9.position.y >= 577 && home9.position.y <= 607)) - sum++; - if ((home10.position.x >= 105 && home10.position.x <= 157 && home10.position.y >= 247 && home10.position.y <= 577) || (home10.position.x >= 65 && home10.position.x <= 157 && home10.position.y >= 217 && home10.position.y <= 247) || (home10.position.x >= 65 && home10.position.x <= 157 && home10.position.y >= 577 && home10.position.y <= 607)) - sum++; - return sum; -} - -// 查找在小区里的机器人 -int CStrategySystem::search2() { - int sum = 0; - if (home1.position.x >= 65 && home1.position.x < 105 && home1.position.y >= 247 && home1.position.y <= 577) - sum++; - if (home2.position.x >= 65 && home2.position.x < 105 && home2.position.y >= 247 && home2.position.y <= 577) - sum++; - if (home3.position.x >= 65 && home3.position.x < 105 && home3.position.y >= 247 && home3.position.y <= 577) - sum++; - if (home4.position.x >= 65 && home4.position.x < 105 && home4.position.y >= 247 && home4.position.y <= 577) - sum++; - if (home5.position.x >= 65 && home5.position.x < 105 && home5.position.y >= 247 && home5.position.y <= 577) - sum++; - if (home6.position.x >= 65 && home6.position.x < 105 && home6.position.y >= 247 && home6.position.y <= 577) - sum++; - if (home7.position.x >= 65 && home7.position.x < 105 && home7.position.y >= 247 && home7.position.y <= 577) - sum++; - if (home8.position.x >= 65 && home8.position.x < 105 && home8.position.y >= 247 && home8.position.y <= 577) - sum++; - if (home9.position.x >= 65 && home9.position.x < 105 && home9.position.y >= 247 && home9.position.y <= 577) - sum++; - if (home10.position.x >= 65 && home10.position.x < 105 && home10.position.y >= 247 && home10.position.y <= 577) - sum++; - return sum; -} - -// 守门 -void CStrategySystem::Goalie() { // TODO 两侧卡顿 - if (start) - ball.oldPosition = ball.position; - // static int xit; - // if (ball.position != ball.oldPosition) - // xit = 0; - // else - // xit++; - if (ball.position.x <= hgoalie.position.x) { - int xix = ball.position.x > 950 ? 965 : 950, xiy, xii = int((double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * 965 + (ball.oldPosition.y - (double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * ball.oldPosition.x) + 0.5), xid = 2; - if (Distance(ball.position, ball.oldPosition) < 1 || ball.position.x <= ball.oldPosition.x || xii < 313 || xii > 505) { - // if (ball.position.x >= 927 && ball.position.y >= 313 && ball.position.y <= 505) { - // xiy = ball.position.y; - // if (xiy < 343 || xiy > 475) - // xix = 965; - // } - // else { - xii = int((double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * 965 + (shooter_pos().y - (double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * shooter_pos().x) + 0.5); - if (xii < 313 || xii > 505) { - xiy = int((Distance(ball.position, CPoint(863, 313)) * 192 / (Distance(ball.position, CPoint(863, 313)) + Distance(ball.position, CPoint(863, 505)))) + 313.5); - if (xiy < 343 || xiy > 475) - xix = 965; - } - else { - if (xii < 343 || xii > 475) - xix = 965; - xiy = int((double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * (xix - xid) + (shooter_pos().y - (double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * shooter_pos().x) + 0.5); - } - if (ball.position.x <= 900 || ball.position.y < 313 || ball.position.y > 505) - if ((T / 4) % 2) - xiy += 30; - else - xiy -= 30; - // } - } - else { - if (xii < 343 || xii > 475) - xix = 965; - xiy = int((double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * (xix - xid) + (ball.oldPosition.y - (double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * ball.oldPosition.x) + 0.5); - } - // if (ball.position.x >= 900 && ball.position.y >= 313 && ball.position.y <= 505 && xit >= 10) // TODO 旋球 - // if (shooter_pos().y > ball.position.y) - // Direction(HGOALIE, CPoint(ball.position.x + 1, ball.position.y + 1)); - // else - // Direction(HGOALIE, CPoint(ball.position.x + 1, ball.position.y - 1)); - // else - Direction(HGOALIE, CPoint(xix, xiy)); - } - else - Stop(HGOALIE); - ball.oldPosition = ball.position; -} - -// 对方射门者位置 -CPoint CStrategySystem::shooter_pos() { - CPoint cur_pos[11]{ opponent.position1, opponent.position2, opponent.position3, opponent.position4, opponent.position5, opponent.position6, opponent.position7, opponent.position8, opponent.position9, opponent.position10, opponent.position11 }; - for (int i = 0; i < 11; i++) { - if (cur_pos[i].x >= ball.position.x) - cur_pos[i] = CPoint(-965, -723); - } - int xii = 0; - double xid = Distance(cur_pos[0], ball.position); - for (int i = 1; i < 11; i++) { - if (Distance(cur_pos[i], ball.position) < xid) { - xid = Distance(cur_pos[i], ball.position); - xii = i; - } - } - return cur_pos[xii]; -} - -double CStrategySystem::Distance(CPoint point1, CPoint point2) { - return sqrt(1.0 * (point1.x - point2.x) * (point1.x - point2.x) + 1.0 * (point1.y - point2.y) * (point1.y - point2.y)); -} - -double CStrategySystem::Angle(CPoint point1, CPoint point2) { - return atan2(1.0 * (point1.y - point2.y), 1.0 * (point1.x - point2.x)); -} - -void CStrategySystem::Direction(int which, CPoint point) { - Robot2 *robot; - double distance_e; - int dx, dy, desired_angle, theta_e, vL, vR; - - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - - point.x = 2 * point.x - robot->position.x; - point.y = 2 * point.y - robot->position.y; - - point.x = point.x < boundRect.left ? boundRect.left : point.x; - point.x = point.x > boundRect.right ? boundRect.right : point.x; - point.y = point.y < boundRect.top ? boundRect.top : point.y; - point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; - - dx = point.x - robot->position.x; - dy = point.y - robot->position.y; - - distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); - - if (dx == 0 && dy == 0) - desired_angle = 90; - else - desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); - - theta_e = desired_angle - robot->angle; - - while (theta_e > 180) - theta_e -= 360; - while (theta_e < -180) - theta_e += 360; - - if (theta_e < -90) { - theta_e += 180; - distance_e = -distance_e; - } - else if (theta_e > 90) { - theta_e -= 180; - distance_e = -distance_e; - } - - vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); - vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); - - Velocity(which, vL, vR); -} - -void CStrategySystem::PositionSE(int which, CPoint point) { - Robot2 *robot; - double distance_e; - int dx, dy, desired_angle, theta_e, vL, vR; - - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - - if (point.x >= 873 && point.y >= 217 && point.y <= 607) - if (robot->position.x >= 873) { - if (robot->position.y <= 217) { - point.x = robot->position.x - (robot->position.x - point.x) * (217 - robot->position.y) / (point.y - robot->position.y); - point.y = 217; - } - else if (robot->position.y >= 607) { - point.x = robot->position.x - (robot->position.x - point.x) * (607 - robot->position.y) / (point.y - robot->position.y); - point.y = 607; - } - } - else { - point.x = 873; - point.y = robot->position.y - (robot->position.y - point.y) * (873 - robot->position.x) / (point.x - robot->position.x); - } - - point.x = point.x < boundRect.left ? boundRect.left : point.x; - point.x = point.x > boundRect.right ? boundRect.right : point.x; - point.y = point.y < boundRect.top ? boundRect.top : point.y; - point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; - - dx = point.x - robot->position.x; - dy = point.y - robot->position.y; - - distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); - - if (dx == 0 && dy == 0) - desired_angle = 90; - else - desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); - - theta_e = desired_angle - robot->angle; - - while (theta_e > 180) - theta_e -= 360; - while (theta_e < -180) - theta_e += 360; - - if (theta_e < -90) { - theta_e += 180; - distance_e = -distance_e; - } - else if (theta_e > 90) { - theta_e -= 180; - distance_e = -distance_e; - } - - vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); - vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); - - Velocity(which, vL, vR); -} - -void CStrategySystem::Rush(int which, CPoint point) { - Robot2 *robot; - double distance_e; - int dx, dy, desired_angle, theta_e, vL, vR; - - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - - CPoint p3; - - // 计算射线的斜率和截距 - double k = (double)(point.y - robot->position.y) / (point.x - robot->position.x); - double b = robot->position.y - k * robot->position.x; - // 判断射线的方向 - bool right = point.x > robot->position.x; // 是否向右 - bool up = point.y < robot->position.y; // 是否向上 - // 根据方向和斜率判断相交边 - if (right && up) { // 右上方 - if (k > 0) { // 斜率大于 0 - // 右边或上边 - if (k * boundRect.right + b < boundRect.top) { - // 右边 - p3.x = boundRect.right; - p3.y = k * boundRect.right + b; - } - else { - // 上边 - p3.x = (boundRect.top - b) / k; - p3.y = boundRect.top; - } - } - else { // 斜率小于等于 0 - // 上边或右边 - if ((boundRect.top - b) / k > boundRect.right) { - // 上边 - p3.x = (boundRect.top - b) / k; - p3.y = boundRect.top; - } - else { - // 右边 - p3.x = boundRect.right; - p3.y = k * boundRect.right + b; - } - } - } - else if (right && !up) { // 右下方 - if (k > 0) { // 斜率大于 0 - // 下边或右边 - if ((boundRect.bottom - b) / k < boundRect.right) { - // 下边 - p3.x = (boundRect.bottom - b) / k; - p3.y = boundRect.bottom; - } - else { - // 右边 - p3.x = boundRect.right; - p3.y = k * boundRect.right + b; - } - } - else { // 斜率小于等于 0 - // 右边或下边 - if (k * boundRect.right + b > boundRect.bottom) { - // 右边 - p3.x = boundRect.right; - p3.y = k * boundRect.right + b; - } - else { - // 下边 - p3.x = (boundRect.bottom - b) / k; - p3.y = boundRect.bottom; - } - } - } - else if (!right && up) { // 左上方 - if (k > 0) { // 斜率大于 0 - // 上边或左边 - if ((boundRect.top - b) / k < boundRect.left) { - // 上边 - p3.x = (boundRect.top - b) / k; - p3.y = boundRect.top; - } - else { - // 左边 - p3.x = boundRect.left; - p3.y = k * boundRect.left + b; - } - } - else { // 斜率小于等于 0 - // 左边或上边 - if (k * boundRect.left + b < boundRect.top) { - // 左边 - p3.x = boundRect.left; - p3.y = k * boundRect.left + b; - } - else { - // 上边 - p3.x = (boundRect.top - b) / k; - p3.y = boundRect.top; - } - } - } - else { // 左下方 - if (k > 0) { // 斜率大于 0 - // 左边或下边 - if (k * boundRect.left + b > boundRect.bottom) { - // 左边 - p3.x = boundRect.left; - p3.y = k * boundRect.left + b; - } - else { - // 下边 - p3.x = (boundRect.bottom - b) / k; - p3.y = boundRect.bottom; - } - } - else { // 斜率小于等于 0 - // 下边或左边 - if ((boundRect.bottom - b) / k > boundRect.left) { - // 下边 - p3.x = (boundRect.bottom - b) / k; - p3.y = boundRect.bottom; - } - else { - // 左边 - p3.x = boundRect.left; - p3.y = k * boundRect.left + b; - } - } - } - - point = p3; - - point.x = point.x < boundRect.left ? boundRect.left : point.x; - point.x = point.x > boundRect.right ? boundRect.right : point.x; - point.y = point.y < boundRect.top ? boundRect.top : point.y; - point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; - - dx = point.x - robot->position.x; - dy = point.y - robot->position.y; - - distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); - - if (dx == 0 && dy == 0) - desired_angle = 90; - else - desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); - - theta_e = desired_angle - robot->angle; - - while (theta_e > 180) - theta_e -= 360; - while (theta_e < -180) - theta_e += 360; - - if (theta_e < -90) { - theta_e += 180; - distance_e = -distance_e; - } - else if (theta_e > 90) { - theta_e -= 180; - distance_e = -distance_e; - } - - vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); - vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); - - Velocity(which, vL, vR); -} - -// 判断状态,1 为罚球,0 为正常, 其他为争球 -int CStrategySystem::Status() { - if (ball.position.x <= 309 && ball.position.x >= 279) { - if (ball.position.y >= 394 && ball.position.y <= 424) - return 1; // 罚球 - if (ball.position.y <= 193 && ball.position.y >= 173) - return 2; // 左上争球点 - if (ball.position.y <= 648 && ball.position.y >= 628) - return 3; // 左下争球点 - } - if (ball.position.x <= 753 && ball.position.x >= 733) { - if (ball.position.y <= 193 && ball.position.y >= 173) - return 4; // 右上争球点 - if (ball.position.y <= 648 && ball.position.y >= 628) - return 5; // 右下争球点 - } - return 0; -} - -void CStrategySystem::Action() { - T++; - Goalie(); - switch (Status()) { - case 1: - flag = true; - Penalty(); - break; - // case 2: - // case 3: - // case 4: - // case 5: - // Freeball(); - // break; - default: - flag = true; - Possession(); - break; - } - if (start) - start = false; -} - -void CStrategySystem::Angle(int which, int desired_angle) { - Robot2 *robot; - int theta_e, vL, vR; - - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - - theta_e = desired_angle - robot->angle; - while (theta_e > 180) - theta_e -= 360; - while (theta_e < -180) - theta_e += 360; - if (theta_e < -90) - theta_e += 180; - else if (theta_e > 90) - theta_e -= 180; - vL = (int)(60.0 / 90.0 * theta_e); - vR = (int)(-60.0 / 90.0 * theta_e); - Velocity(which, vL, vR); -} - -void CStrategySystem::Velocity(int which, int vL, int vR) { - if (vL < -127) - vL = -127; - if (vL > 127) - vL = 127; - - if (vR < -127) - vR = -127; - if (vR > 127) - vR = 127; - - switch (which) { - case HOME1: - command[2] = vL; - command[3] = vR; - command[4] = C_GO; - break; - case HOME2: - command[5] = vL; - command[6] = vR; - command[7] = C_GO; - break; - case HOME3: - command[8] = vL; - command[9] = vR; - command[10] = C_GO; - break; - case HOME4: - command[11] = vL; - command[12] = vR; - command[13] = C_GO; - break; - case HOME5: - command[14] = vL; - command[15] = vR; - command[16] = C_GO; - break; - case HOME6: - command[17] = vL; - command[18] = vR; - command[19] = C_GO; - break; - case HOME7: - command[20] = vL; - command[21] = vR; - command[22] = C_GO; - break; - case HOME8: - command[23] = vL; - command[24] = vR; - command[25] = C_GO; - break; - case HOME9: - command[26] = vL; - command[27] = vR; - command[28] = C_GO; - break; - case HOME10: - command[29] = vL; - command[30] = vR; - command[31] = C_GO; - break; - case HGOALIE: - command[32] = vL; - command[33] = vR; - command[34] = C_GO; - break; - } -} - -void CStrategySystem::Position(int which, CPoint point) { - Robot2 *robot; - double distance_e; - int dx, dy, desired_angle, theta_e, vL, vR; - - switch (which) { - case HOME1: - robot = &home1; - break; - case HOME2: - robot = &home2; - break; - case HOME3: - robot = &home3; - break; - case HOME4: - robot = &home4; - break; - case HOME5: - robot = &home5; - break; - case HOME6: - robot = &home6; - break; - case HOME7: - robot = &home7; - break; - case HOME8: - robot = &home8; - break; - case HOME9: - robot = &home9; - break; - case HOME10: - robot = &home10; - break; - case HGOALIE: - robot = &hgoalie; - break; - } - - point.x = point.x < boundRect.left ? boundRect.left : point.x; - point.x = point.x > boundRect.right ? boundRect.right : point.x; - point.y = point.y < boundRect.top ? boundRect.top : point.y; - point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; - - dx = point.x - robot->position.x; - dy = point.y - robot->position.y; - - distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); - - if (dx == 0 && dy == 0) - desired_angle = 90; - else - desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); - - theta_e = desired_angle - robot->angle; - - while (theta_e > 180) - theta_e -= 360; - while (theta_e < -180) - theta_e += 360; - - if (theta_e < -90) { - theta_e += 180; - distance_e = -distance_e; - } - else if (theta_e > 90) { - theta_e -= 180; - distance_e = -distance_e; - } - - vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); - vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); - - Velocity(which, vL, vR); -} - -void CStrategySystem::Stop(int which) { - int vL, vR; - vL = vR = 0; - Velocity(which, vL, vR); -} - -void CStrategySystem::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) { - if (m_nGameArea == GAME_RIGHT) { - ball.position = bal.position; - ball.angle = bal.angle; - - home1.position = ho1.position; - home1.angle = ho1.angle; - - home2.position = ho2.position; - home2.angle = ho2.angle; - - home3.position = ho3.position; - home3.angle = ho3.angle; - - home4.position = ho4.position; - home4.angle = ho4.angle; - - home5.position = ho5.position; - home5.angle = ho5.angle; - - home6.position = ho6.position; - home6.angle = ho6.angle; - - home7.position = ho7.position; - home7.angle = ho7.angle; - - home8.position = ho8.position; - home8.angle = ho8.angle; - - home9.position = ho9.position; - home9.angle = ho9.angle; - - home10.position = ho10.position; - home10.angle = ho10.angle; - - hgoalie.position = hgo.position; - hgoalie.angle = hgo.angle; - - opponent.position1 = opp.position1; - opponent.position2 = opp.position2; - opponent.position3 = opp.position3; - opponent.position4 = opp.position4; - opponent.position5 = opp.position5; - opponent.position6 = opp.position6; - opponent.position7 = opp.position7; - opponent.position8 = opp.position8; - opponent.position9 = opp.position9; - opponent.position10 = opp.position10; - opponent.position11 = opp.position11; - } - else { - ball.position.x = 1030 - bal.position.x; - ball.position.y = 818 - bal.position.y; - if (ball.angle > 0) - ball.angle = bal.angle - 180; - else - ball.angle = 180 + bal.angle; - - home1.position.x = 1030 - ho1.position.x; - home1.position.y = 818 - ho1.position.y; - if (home1.angle > 0) - home1.angle = ho1.angle - 180; - else - home1.angle = 180 + ho1.angle; - home2.position.x = 1030 - ho2.position.x; - home2.position.y = 818 - ho2.position.y; - if (home2.angle > 0) - home2.angle = ho2.angle - 180; - else - home2.angle = 180 + ho2.angle; - home3.position.x = 1030 - ho3.position.x; - home3.position.y = 818 - ho3.position.y; - if (home3.angle > 0) - home3.angle = ho3.angle - 180; - else - home3.angle = 180 + ho3.angle; - home4.position.x = 1030 - ho4.position.x; - home4.position.y = 818 - ho4.position.y; - if (home4.angle > 0) - home4.angle = ho4.angle - 180; - else - home4.angle = 180 + ho4.angle; - home5.position.x = 1030 - ho5.position.x; - home5.position.y = 818 - ho5.position.y; - if (home5.angle > 0) - home5.angle = ho5.angle - 180; - else - home5.angle = 180 + ho5.angle; - //*/ - home6.position.x = 1030 - ho6.position.x; - home6.position.y = 818 - ho6.position.y; - ///* - if (home6.angle > 0) - home6.angle = ho6.angle - 180; - else - home6.angle = 180 + ho6.angle; - //*/ - home7.position.x = 1030 - ho7.position.x; - home7.position.y = 818 - ho7.position.y; - ///* - if (home7.angle > 0) - home7.angle = ho7.angle - 180; - else - home7.angle = 180 + ho7.angle; - //*/ - home8.position.x = 1030 - ho8.position.x; - home8.position.y = 818 - ho8.position.y; - ///* - if (home8.angle > 0) - home8.angle = ho8.angle - 180; - else - home8.angle = 180 + ho8.angle; - //*/ - home9.position.x = 1030 - ho9.position.x; - home9.position.y = 818 - ho9.position.y; - ///* - if (home9.angle > 0) - home9.angle = ho9.angle - 180; - else - home9.angle = 180 + ho9.angle; - //*/ - home10.position.x = 1030 - ho10.position.x; - home10.position.y = 818 - ho10.position.y; - ///* - if (home10.angle > 0) - home10.angle = ho10.angle - 180; - else - home10.angle = 180 + ho10.angle; - //*/ - hgoalie.position.x = 1030 - hgo.position.x; - hgoalie.position.y = 818 - hgo.position.y; - ///* - if (hgoalie.angle > 0) - hgoalie.angle = hgo.angle - 180; - else - hgoalie.angle = 180 + hgo.angle; - //*/ - opponent.position1.x = 1030 - opp.position1.x; - opponent.position2.x = 1030 - opp.position2.x; - opponent.position3.x = 1030 - opp.position3.x; - opponent.position4.x = 1030 - opp.position4.x; - opponent.position5.x = 1030 - opp.position5.x; - opponent.position6.x = 1030 - opp.position6.x; - opponent.position7.x = 1030 - opp.position7.x; - opponent.position8.x = 1030 - opp.position8.x; - opponent.position9.x = 1030 - opp.position9.x; - opponent.position10.x = 1030 - opp.position10.x; - opponent.position11.x = 1030 - opp.position11.x; - - opponent.position1.y = 818 - opp.position1.y; - opponent.position2.y = 818 - opp.position2.y; - opponent.position3.y = 818 - opp.position3.y; - opponent.position4.y = 818 - opp.position4.y; - opponent.position5.y = 818 - opp.position5.y; - opponent.position6.y = 818 - opp.position6.y; - opponent.position7.y = 818 - opp.position7.y; - opponent.position8.y = 818 - opp.position8.y; - opponent.position9.y = 818 - opp.position9.y; - opponent.position10.y = 818 - opp.position10.y; - opponent.position11.y = 818 - opp.position11.y; - } -} - -CStrategySystem::CStrategySystem(int id) { - T = 0; - - start = true; - - pos = new CPoint[10]; - rp = new RelPos[10]; - - for (int i = 0; i < 10; i++) { - rp[i].ang = 0; - rp[i].dis = 0; - rp[i].id = i + 1; - } - - flag = true; - - m_OurTeam = id; - boundRect.SetRect(65, 95, 965, 723); - if (id) - m_nGameArea = GAME_LEFT; - else - m_nGameArea = GAME_RIGHT; - for (int i = 0; i < 35; i++) - command[i] = 0; - C_Home1.Data.Lv = 0; - C_Home1.Data.Rv = 0; - C_Home1.Data.Command = C_STOP; - C_Home2.Data.Lv = 0; - C_Home2.Data.Rv = 0; - C_Home2.Data.Command = C_STOP; - C_Home3.Data.Lv = 0; - C_Home3.Data.Rv = 0; - C_Home3.Data.Command = C_STOP; - C_Home4.Data.Lv = 0; - C_Home4.Data.Rv = 0; - C_Home4.Data.Command = C_STOP; - C_Home5.Data.Lv = 0; - C_Home5.Data.Rv = 0; - C_Home5.Data.Command = C_STOP; - C_Home6.Data.Lv = 0; - C_Home6.Data.Rv = 0; - C_Home6.Data.Command = C_STOP; - C_Home7.Data.Lv = 0; - C_Home7.Data.Rv = 0; - C_Home7.Data.Command = C_STOP; - C_Home8.Data.Lv = 0; - C_Home8.Data.Rv = 0; - C_Home8.Data.Command = C_STOP; - C_Home9.Data.Lv = 0; - C_Home9.Data.Rv = 0; - C_Home9.Data.Command = C_STOP; - C_Home10.Data.Lv = 0; - C_Home10.Data.Rv = 0; - C_Home10.Data.Command = C_STOP; - C_Home11.Data.Lv = 0; - C_Home11.Data.Rv = 0; - C_Home11.Data.Command = C_STOP; - - m_nStrategy = id; // left = 0, right = 1 - nKick = 0; - nKick2 = 0; - nShoot = 0; - nSweep = 0; -} - -// CStrategySystem::~CStrategySystem() { -// } +#include "StdAfx.h" +#include "StrategySystem.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +IMPLEMENT_DYNAMIC(CStrategySystem, CObject) + +extern int nKick; +#define BALL_WIDTH 78 +#define BALL_LENGTH 156 +#define BALL_DIS 26 +#define CORNER 115 + +#define ANGLE_BOUND 60 +#define BOUND_BOUND 12 +#define G_OFFSET 20 +#define G_ANGLE_BOUND 60 +#define G_BOUND_BOUND 10 + +// 罚球 +void CStrategySystem::Penalty() { + srand(time(nullptr)); + int x = rand() % 2; + int d = 21; + static bool faceR; // 角度 + if (x) { + if (Distance(home1.position, ball.position) > d) { + Direction(HOME1, ball.position); + faceR = fabs(home1.angle) > 90; + } + else { + double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 505)))); // 求曲线行驶时轨迹的半径 + int lw = r / (r + 6) * 127; + if (faceR) + Velocity(1, lw, 127); + else + Velocity(1, -127, -lw); + } + } + else { + if (Distance(home1.position, ball.position) > d) { + Direction(HOME1, ball.position); + faceR = fabs(home1.angle) > 90; + } + else { + double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 313)))); + int rw = r / (r + 6) * 127; + if (!faceR) + Velocity(1, -rw, -127); + else + Velocity(1, 127, rw); + } + } + Direction(HOME2, ball.position); + Direction(HOME3, ball.position); + Direction(HOME4, ball.position); + Direction(HOME5, ball.position); + Direction(HOME6, ball.position); + Direction(HOME7, ball.position); + Direction(HOME8, ball.position); + Direction(HOME9, ball.position); + Direction(HOME10, ball.position); +} + +// 争球 +void CStrategySystem::Freeball() { + // 要实现先直冲,在曲线的话,就要加一个标识符标识此时的状态,当距离不足时标识符为1,距离够时标识符变为0,并且在争球结束后变为1 + // 感觉防御的话就直冲判断比较简单粗暴,毕竟目标是拦截,而不是射门, + static bool faceR; + int d = 25; + if (Status() == 2) { // 左上 + Direction(HOME3, ball.position); + Direction(HOME1, ball.position); + Direction(HOME2, ball.position); + Direction(HOME4, ball.position); + Direction(HOME5, ball.position); + Direction(HOME6, ball.position); + Direction(HOME7, ball.position); + Direction(HOME8, ball.position); + Direction(HOME9, ball.position); + Direction(HOME10, ball.position); + } + else if (Status() == 3) { // 左下 + Direction(HOME1, ball.position); + } + /* if (Status() == 2) { // 左上 + if (Distance(home3.position, ball.position) > d && flag) { + Direction(HOME3, CPoint(ball.position.x,ball.position.y-6)); + faceR = fabs(home3.angle) > 90; + } + else { + flag = false; + double r = Distance(home3.position, ball.position) / (2 * (sin(atwo(home3.pos.x, home3.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 605)))); // 求曲线行驶时轨迹的半径 + int lw = (r-5) / (r +8) * 127; + if (faceR) + Velocity(3, lw, 127); + else + Velocity(3, -127, -lw); + } + Direction(HOME1, ball.position); + Direction(HOME2, ball.position); + Direction(HOME4, ball.position); + Direction(HOME5, ball.position); + Direction(HOME6, ball.position); + Direction(HOME7, ball.position); + Direction(HOME8, ball.position); + Direction(HOME9, ball.position); + Direction(HOME10, ball.position); + } + + else if (Status() == 3) { // 左下 + if (Distance(home1.position, ball.position) > d && flag) { + Direction(HOME1, ball.position); + faceR = fabs(home1.angle) > 90; + } + else { + flag = false; + double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 213)))); + int rw = (r - 5) / (r + 8) * 127; + if (!faceR) + Velocity(1, -rw, -127); + else + Velocity(1, 127, rw); + } + Direction(HOME2, ball.position); + Direction(HOME3, ball.position); + Direction(HOME4, ball.position); + Direction(HOME5, ball.position); + Direction(HOME6, ball.position); + Direction(HOME7, ball.position); + Direction(HOME8, ball.position); + Direction(HOME9, ball.position); + Direction(HOME10, ball.position); + }*/ + else if (Status() == 4) { // 右上 + Direction(HOME10, ball.position); + } + /*else if (Status() == 4) { // 右上 + if (Distance(home10.position, ball.position) > d && flag) { + Direction(HOME10, ball.position); + faceR = fabs(home10.angle) > 90; + } + else { + flag = false; + double r = Distance(home10.position, ball.position) / (2 * (sin(atwo(home10.pos.x, home10.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 515, 95)))); + int rw = (r - 5) / (r + 5) * 127; + if (faceR) + Velocity(10, -rw, -127); + else + Velocity(10, 127, rw); + } + Direction(HOME1, ball.position); + Direction(HOME2, ball.position); + Direction(HOME3, ball.position); + Direction(HOME4, ball.position); + Direction(HOME5, ball.position); + Direction(HOME6, ball.position); + Direction(HOME7, ball.position); + Direction(HOME8, ball.position); + Direction(HOME9, ball.position); + } */ + /* else if (Status() == 5) { // 右下 + if (Distance(home7.position, ball.position) > d && flag) { + Direction(HOME7, ball.position); + faceR = fabs(home7.angle) > 90; + } + else { + flag = false; + double r = Distance(home7.position, ball.position) / (2 * (sin(atwo(home7.pos.x, home7.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 515, 723)))); + int lw = (r - 8) / (r + 5) * 127; + if (faceR) + Velocity(7, -127, -lw); + else + Velocity(7, lw, 127); + } + Direction(HOME1, ball.position); + Direction(HOME2, ball.position); + Direction(HOME3, ball.position); + Direction(HOME4, ball.position); + Direction(HOME5, ball.position); + Direction(HOME6, ball.position); + Direction(HOME8, ball.position); + Direction(HOME9, ball.position); + Direction(HOME10, ball.position); + }*/ + else if (Status() == 5) { // 右下//也许还有其它改进的思路,但实在南蚌 + Direction(HOME7, ball.position); + } + else // 这个标识符判断的问题到底咋搞,放在这的话应该是要在action函数里把freeball函数一直调用,如果要把还原放在action函数的话就要再不是争球的情况下都还原 + flag = 1; +} + +// 两直线间夹角 +double CStrategySystem::atwo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { + double j = 0; + double k1 = (y1 - y2) / (x1 - x2); + double k2 = (y3 - y4) / (x3 - x4); + j = atan(fabs((k2 - k1) / (1 + k1 * k2))); + return j; +} + +// void CStrategySystem::spin(int which, bool isClockwise) { // 自旋 +// if (isClockwise) +// Velocity(which, 127, -127); +// else +// Velocity(which, -127, 127); +// } + +// 控球 +// void CStrategySystem::Possession() { +// navigate(); +/*for(int i=1;i<11;i++) +{ + Navigation[i]=ball.position; +}*/ + +// if (ball.position.x < 290) { +// Canshot(); +// for (int i = 1; i < 9; i++) { +// control(i); +// } +// } +// else +// for (int i = 1; i < 11; i++) { +// control(i); +// } + +// bool a, b; +// if (ball.position.y >= 337 && ball.position.x < 290) // 球在敌方下半 +// { +// if ((ball.position.y >= 481 && ball.position.y <= 607) || (ball.position.x - ball.oldPosition.x <= 5 && ball.position.y - ball.oldPosition.y <= 5) && search1() < 4) // 7可射 +// shot(7, 1); // 7射 +// else +// control(7); + +// if (Distance(ball.position, home2.position) <= 75) // 2可射 +// { +// control(1); // 1 +// if (search1() < 4) +// shot(HOME2, 1); // 2射 +// else +// control(2); +// for (int i = 3; i < 7; i++) // 3-6 +// control(i); +// control(1); // 8 +// if (!canshot()) // 9,10 +// { +// control(9); +// control(10); +// } +// } +// else if (Distance(ball.position, home3.position) <= 75 && ball.position.y <= 481 && ball.position.y >= 505) // 3可射 +// { +// control(1); // 1 +// control(2); // 2 +// if (search1() < 4) +// shot(HOME3, 0); // 3射 +// else +// control(3); +// for (int i = 4; i < 7; i++) // 4-6 +// control(i); +// control(8); // 8 +// if (!canshot()) // 9,10 +// { +// control(9); +// control(10); +// } +// } +// else // 其它情况 +// for (int i = 1; i < 11; i++) // 1-10 +// control(i); +// } +// else if (ball.position.y < 481 && ball.position.x < 290) // 球在敌方上半 +// { +// if ((ball.position.y >= 217 && ball.position.y <= 337) || (ball.position.x - ball.oldPosition.x <= 5 && ball.position.y - ball.oldPosition.y <= 5) && search1() < 4) // 8可射 +// shot(8, 0); +// else +// control(8); +// if (Distance(ball.position, home3.position) <= 75) // 3可射 +// { +// control(1); // 1 +// control(2); // 2 +// if (search1() < 4) +// shot(HOME3, 0); // 3射 +// else +// control(3); +// for (int i = 4; i < 7; i++) // 4-6 +// control(i); +// control(HOME7); // 7 +// if (!canshot()) // 9,10 +// { +// control(9); +// control(10); +// } +// } +// else if (Distance(ball.position, home2.position) <= 75 && ball.position.y >= 313 && ball.position.y <= 337) // 2可射 +// { + +// control(1); // 1 +// if (search1() < 4) +// shot(2, 0); // 2射 +// else +// control(2); +// control(HOME3); // 3 +// for (int i = 4; i < 7; i++) // 4-6 +// control(i); +// control(HOME7); // 7 +// if (!canshot()) // 9,10 +// { +// control(9); +// control(10); +// } +// } +// else // 其它情况 +// for (int i = 1; i < 11; i++) // 1-10 +// control(i); +// } +// else // 其它情况 +// for (int i = 1; i < 11; i++) // 1-10 +// control(i); +//} + +// 控球具体实现 +void CStrategySystem::Possession() { + CPoint pos[10]; // pos[0] 中央球员;p[1:9] 阵型球员 + + RelPos rp[10]; // 阵型球员相对中央球员的位置 + for (int i = 0; i < 10; i++) + rp[i].id = i + 1; + + CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; + if (cp_id()) { + pos[0] = cur_pos[cp_id() - 1]; + + for (int i = 0; i < 10; i++) { + if (rp[i].id == cp_id()) { + rp[i].ang = 0; + rp[i].dis = 0; + } + else { + rp[i].ang = atan2(cur_pos[i].y - pos[0].y, cur_pos[i].x - pos[0].x); + rp[i].dis = Distance(cur_pos[i], pos[0]); + } + } + + RelPos r; + + // 孙徐 + if (fm_id() == 1) { + Direction(cp_id(), ball.position); + + pos[1] = CPoint(pos[0].x, pos[0].y - 20); + pos[2] = CPoint(pos[0].x + 20, pos[0].y - 20); + pos[3] = CPoint(pos[0].x + 20, pos[0].y); + pos[6] = CPoint(pos[0].x + 40, pos[0].y); + pos[4] = CPoint(pos[0].x + 20, pos[0].y + 20); + pos[7] = CPoint(pos[0].x + 40, pos[0].y + 20); + pos[5] = CPoint(pos[0].x + 20, pos[0].y + 40); + pos[8] = CPoint(170, 409); + pos[9] = CPoint(170, 556); + + fp_sort(rp); + fp_sort(rp, 0, 5); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + fp_sort(rp, 5, 7); + Direction(rp[6].id, pos[6]); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + else if (fm_id() == 2) { + Direction(cp_id(), ball.position); + + pos[1] = CPoint(pos[0].x, pos[0].y + 20); + pos[2] = CPoint(pos[0].x + 20, pos[0].y + 20); + pos[3] = CPoint(pos[0].x + 20, pos[0].y); + pos[6] = CPoint(pos[0].x + 40, pos[0].y); + pos[4] = CPoint(pos[0].x + 20, pos[0].y - 20); + pos[7] = CPoint(pos[0].x + 40, pos[0].y - 20); + pos[5] = CPoint(pos[0].x + 20, pos[0].y - 40); + pos[8] = CPoint(170, 409); + pos[9] = CPoint(170, 265); + + fp_sort(rp); + fp_sort(rp, 0, 5); + Direction(rp[5].id, pos[1]); + Direction(rp[4].id, pos[2]); + Direction(rp[3].id, pos[3]); + Direction(rp[2].id, pos[4]); + Direction(rp[1].id, pos[5]); + fp_sort(rp, 5, 7); + Direction(rp[6].id, pos[6]); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + else if (fm_id() == 3) { + if (ball.position.x >= 157 && ball.position.x <= 290 && ball.position.y <= 409) { + // 内圈 + pos[1] = CPoint(pos[0].x - 20, pos[0].y - 40); + pos[2] = CPoint(pos[0].x + 20, pos[0].y - 40); + pos[3] = CPoint(pos[0].x + 40 * cos(30), pos[0].y - 40 * sin(30)); + pos[4] = CPoint(pos[0].x + 40 * cos(30), pos[0].y + 40 * sin(40)); + pos[5] = CPoint(pos[0].x + 20, pos[0].y + 40); + pos[6] = CPoint(pos[0].x - 20, pos[0].y + 40); + // 内圈 + pos[7] = CPoint(pos[0].x + 120 * cos(67.5), pos[0].y - 120 * sin(67.5)); + pos[8] = CPoint(pos[0].x + 120 * cos(45), pos[0].y - 120 * sin(45)); + pos[9] = CPoint(pos[0].x + 120 * cos(22.5), pos[0].y - 120 * sin(22.5)); + shot(cp_id(), CPoint(45, 361)); + fp_sort(rp); + fp_sort(rp, 0, 6); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + fp_sort(rp, 5, 8); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + else if (ball.position.x >= 157 && ball.position.x <= 290 && ball.position.y > 409) { + // 内圈 + pos[1] = CPoint(pos[0].x - 20, pos[0].y - 40); + pos[2] = CPoint(pos[0].x + 20, pos[0].y - 40); + pos[3] = CPoint(pos[0].x + 40 * cos(30), pos[0].y - 40 * sin(30)); + pos[4] = CPoint(pos[0].x + 40 * cos(30), pos[0].y + 40 * sin(40)); + pos[5] = CPoint(pos[0].x + 20, pos[0].y + 40); + pos[6] = CPoint(pos[0].x - 20, pos[0].y + 40); + // 内圈 + pos[7] = CPoint(pos[0].x + 120 * cos(67.5), pos[0].y + 120 * sin(67.5)); + pos[8] = CPoint(pos[0].x + 120 * cos(45), pos[0].y + 120 * sin(45)); + pos[9] = CPoint(pos[0].x + 120 * cos(22.5), pos[0].y + 120 * sin(22.5)); + shot(cp_id(), CPoint(45, 457)); + fp_sort(rp); + fp_sort(rp, 0, 6); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + fp_sort(rp, 5, 8); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + else if (ball.position.x < 157 && ball.position.y >= 217 && ball.position.y <= 409) // 球在上半 + { + pos[1] = CPoint(142, pos[0].y - 20); + pos[2] = CPoint(142, pos[0].y + 20); + + pos[3] = CPoint(170, pos[0].y - 20); + pos[4] = CPoint(170, pos[0].y + 20); + pos[5] = CPoint(185, pos[0].y - 12); + if (pos[0].y - 50 < 157) + pos[6] = CPoint(ball.position.x + 12, 225); + else + pos[6] = CPoint(170, pos[0].y - 50); + pos[7] = CPoint(ball.position.x, 225); + pos[8] = CPoint(170, pos[0].y + 45); + pos[9] = CPoint(170, pos[0].y + 405); + shot(cp_id()); + fp_sort(rp, 0, 8); + Direction(rp[7].id, pos[1]); + Direction(rp[8].id, pos[2]); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[1].id, pos[6]); + Direction(rp[2].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + else if (ball.position.x < 157 && ball.position.y >= 217 && ball.position.y > 409) // 球在下半 + { + pos[1] = CPoint(142, pos[0].y - 20); + pos[2] = CPoint(142, pos[0].y + 20); + + pos[3] = CPoint(170, pos[0].y - 20); + pos[4] = CPoint(170, pos[0].y + 20); + pos[5] = CPoint(185, pos[0].y + 12); + if (pos[0].y + 50 > 607) + pos[6] = CPoint(ball.position.x + 12, 615); + else + pos[6] = CPoint(170, pos[0].y + 50); + pos[7] = CPoint(ball.position.x, 615); + pos[8] = CPoint(170, pos[0].y - 45); + pos[9] = CPoint(170, pos[0].y - 405); + shot(cp_id()); + fp_sort(rp, 0, 8); + Direction(rp[7].id, pos[1]); + Direction(rp[8].id, pos[2]); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[1].id, pos[6]); + Direction(rp[2].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + } + + // 王徐 + else if (fm_id() == 4) { + Direction(cp_id(), ball.position); + + pos[1] = CPoint(ball.position.x + (int)cos(45.0 * PI / 180.0) * 20, ball.position.y + (int)sin(45.0 * PI / 180.0) * 20); + pos[2] = CPoint(ball.position.x + (int)cos(90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(90.0 * PI / 180.0) * 20); + pos[3] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); + pos[4] = CPoint(pos[0].x + (int)cos(15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(15.0 * PI / 180.0) * 40); + pos[5] = CPoint(pos[0].x + (int)cos(30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(30.0 * PI / 180.0) * 40); + pos[6] = CPoint(pos[0].x + (int)cos(45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(45.0 * PI / 180.0) * 40); + pos[7] = CPoint(pos[0].x + (int)cos(50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(50.0 * PI / 180.0) * 60); + pos[8] = CPoint(pos[0].x + (int)cos(60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(60.0 * PI / 180.0) * 60); + pos[9] = CPoint(pos[0].x + (int)cos(75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(75.0 * PI / 180.0) * 60); + + fp_sort(rp); + fp_sort(rp, 0, 2); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 2, 6); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + fp_sort(rp, 6, 9); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + + /*double d[10], dy[10]; + CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; + for (int i = 0; i <= 9; i++) { + if (i == cp_id() - 1) { + d[i] = 1e5; + } + else { + d[i] = Distance(cur_pos[i], cur_pos[cp_id() - 1]); + } + } + int p1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + for (int i = 1; i <= 10; i++) { + for (int j = 0; j < 10 - i; j++) { + if (d[j] > d[j + 1]) { + int tmp = d[j]; + d[j] = d[j + 1]; + d[j + 1] = tmp; + tmp = p1[j]; + p1[j] = p1[j + 1]; + p1[j + 1] = tmp; + } + } + } + Direction(p1[0], pos[0]); + Direction(p1[1], pos[1]); + for (int i = 0; i <= 9; i++) { + if (i == cp_id() - 1) { + dy[i] = 1e5; + } + else { + dy[p1[i]] = 217 - cur_pos[i].y; + } + } + dy[p1[0]] = 1e5; + dy[p1[1]] = 1e5; + int p2[10] = { p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9] }; + for (int i = 1; i <= 10; i++) { + for (int j = 0; j < 10 - i; j++) { + if (dy[j] > dy[j + 1]) { + int tmp = d[j]; + dy[j] = dy[j + 1]; + dy[j + 1] = tmp; + tmp = p2[j]; + p2[j] = p2[j + 1]; + p2[j + 1] = tmp; + } + } + } + Direction(p2[0], pos[9]); + Direction(p2[1], pos[8]); + Direction(p2[2], pos[7]); + Direction(p2[3], pos[6]); + Direction(p2[4], pos[5]); + Direction(p2[5], pos[4]); + Direction(p2[6], pos[3]);*/ + } + else if (fm_id() == 5) { + Direction(cp_id(), ball.position); + + pos[2] = CPoint(ball.position.x + (int)cos(0.0 * PI / 180.0) * 20, ball.position.y + (int)sin(0.0 * PI / 180.0) * 20); + pos[1] = CPoint(ball.position.x + (int)cos(-90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(-90.0 * PI / 180.0) * 20); + pos[6] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); + pos[5] = CPoint(pos[0].x + (int)cos(-15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-15.0 * PI / 180.0) * 40); + pos[4] = CPoint(pos[0].x + (int)cos(-30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-30.0 * PI / 180.0) * 40); + pos[3] = CPoint(pos[0].x + (int)cos(-45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(6 - 45.0 * PI / 180.0) * 40); + pos[9] = CPoint(pos[0].x + (int)cos(-50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-50.0 * PI / 180.0) * 60); + pos[8] = CPoint(pos[0].x + (int)cos(-60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-60.0 * PI / 180.0) * 60); + pos[7] = CPoint(pos[0].x + (int)cos(-75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-75.0 * PI / 180.0) * 60); + + fp_sort(rp); + fp_sort(rp, 0, 2); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 2, 6); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + fp_sort(rp, 6, 9); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + + // double d[10], dy[10]; // dy是球员新的 + // CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; + // for (int i = 0; i <= 9; i++) { + // if (i == cp_id() - 1) { + // d[i] = 1e5; + // } + // else { + // d[i] = Distance(cur_pos[i], cur_pos[cp_id() - 1]); + // } + // } + // int p1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // p1是球员新下标 + // for (int i = 1; i <= 10; i++) { + // for (int j = 0; j < 10 - i; j++) { + // if (d[j] > d[j + 1]) { + // // 根据球员与中心球员距离,按从小到大排列距离 + // int tmp = d[j]; + // d[j] = d[j + 1]; + // d[j + 1] = tmp; + + // // 距离交换后,下标同时交换 + // tmp = p1[j]; + // p1[j] = p1[j + 1]; + // p1[j + 1] = tmp; + // } + // } + //} + // Direction(p1[0], pos[0]); + // Direction(p1[1], pos[1]); + // for (int i = 0; i <= 9; i++) { + // if (i == cp_id() - 1) { + // dy[i] = 1e5; + // } + // else { + // dy[p1[i]] = cur_pos[i].y - 607; + // } + //} + // dy[p1[0]] = 1e5; + // dy[p1[1]] = 1e5; + //// p2 + // int p2[10] = { p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9] }; + // for (int i = 1; i <= 10; i++) { + // for (int j = 0; j < 10 - i; j++) { + // if (dy[j] > dy[j + 1]) { + // int tmp = d[j]; + // dy[j] = dy[j + 1]; + // dy[j + 1] = tmp; + + // // 距离交换后,下标同时交换 + // tmp = p2[j]; + // p2[j] = p2[j + 1]; + // p2[j + 1] = tmp; + // } + // } + //} + // Direction(p2[0], pos[9]); + // Direction(p2[1], pos[8]); + // Direction(p2[2], pos[7]); + // Direction(p2[3], pos[6]); + // Direction(p2[4], pos[5]); + // Direction(p2[5], pos[4]); + // Direction(p2[6], pos[3]); + } + else if (fm_id() == 6) { + Direction(cp_id(), ball.position); + + pos[1] = CPoint(ball.position.x + (int)cos(-90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(-90.0 * PI / 180.0) * 20); + pos[2] = CPoint(ball.position.x + (int)cos(90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(90.0 * PI / 180.0) * 20); + pos[5] = CPoint(pos[0].x + (int)cos(45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(45.0 * PI / 180.0) * 40); + pos[3] = CPoint(pos[0].x + (int)cos(-45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-45.0 * PI / 180.0) * 40); + pos[4] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); + pos[9] = CPoint(pos[0].x + (int)cos(60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(60.0 * PI / 180.0) * 60); + pos[6] = CPoint(pos[0].x + (int)cos(-60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-60.0 * PI / 180.0) * 60); + pos[8] = CPoint(pos[0].x + (int)cos(30.0 * PI / 180.0) * 60, pos[0].y + (int)sin(30.0 * PI / 180.0) * 60); + pos[7] = CPoint(pos[0].x + (int)cos(-30.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-30.0 * PI / 180.0) * 60); + + fp_sort(rp); + fp_sort(rp, 0, 2); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 2, 5); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + fp_sort(rp, 5, 9); + Direction(rp[6].id, pos[6]); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + + /*int d[10]; + CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; + for (int i = 0; i <= 9; i++) { + if (i == cp_id() - 1) { + d[i] = 1e5; + } + d[i] = cur_pos[i].x - cur_pos[cp_id() - 1].x; + } + int p[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + for (int i = 1; i <= 10; i++) { + int j; + for (j = 0; j < 10 - i; j++) { + if (d[j] > d[j + 1]) { + int tmp = d[j]; + d[j] = d[j + 1]; + d[j + 1] = tmp; + tmp = p[j]; + p[j] = p[j + 1]; + p[j + 1] = tmp; + } + } + } + for (int i = 0; i <= 9; i++) { + if (p[i] = cp_id() - 1) + continue; + Direction(p[i], pos[i + 1]); + }*/ + } + // 景缪 + else if (fm_id() == 7) { + Direction(cp_id(), ball.position); + + if (ball.position.x > 873) { + pos[1] = CPoint(pos[0].x + 20, pos[0].y - 15); + pos[2] = CPoint(pos[0].x + 20, pos[0].y + 15); + pos[3] = CPoint(pos[0].x + 10, pos[0].y + 30); + pos[4] = CPoint(pos[0].x - 20, pos[0].y + 20); + pos[5] = CPoint(pos[0].x + 20, pos[0].y - 30); + pos[6] = CPoint(pos[0].x - 40, pos[0].y + 20); + pos[7] = CPoint(896, 217); + pos[8] = CPoint(919, 217); + pos[9] = CPoint(942, 217); + } + else { + pos[1] = CPoint(pos[0].x, pos[0].y - 20); + pos[2] = CPoint(pos[0].x + 10, pos[0].y + 20); + pos[3] = CPoint(pos[0].x - 25, pos[0].y + 30); + pos[4] = CPoint(pos[0].x - 40, pos[0].y + 30); + pos[5] = CPoint(pos[0].x + 10, pos[0].y + 50); + pos[6] = CPoint(pos[0].x + 50, pos[0].y - 10); + int n1 = 643 > ball.position.x ? 623 : ball.position.x; + int n2 = 733 > ball.position.x ? 733 : ball.position.x; + pos[7] = CPoint(n1, 217); + pos[8] = CPoint(n2, 217); + pos[9] = CPoint(939, 217); + } + + fp_sort(rp); + fp_sort(rp, 0, 2); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 2, 6); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + fp_sort(rp, 6, 9); + PositionSE(rp[7].id, pos[7]); + PositionSE(rp[8].id, pos[8]); + PositionSE(rp[9].id, pos[9]); + + // double adou[15]; + // int xz[15]; + // int n = 1; + // xz[n] = cp_id(); + // int pp[15]; + // for (int i = 1; i <= 9; i++) // 按角度从小到大排序,然后最小的占据点位,并且后续将已分配的记名,不参与接下来的分配 + // { + // for (int u = 1; u <= 10; u++) { + // Robot2 *robot; + // switch (u) { + // case HOME1: + // robot = &home1; + // break; + // case HOME2: + // robot = &home2; + // break; + // case HOME3: + // robot = &home3; + // break; + // case HOME4: + // robot = &home4; + // break; + // case HOME5: + // robot = &home5; + // break; + // case HOME6: + // robot = &home6; + // break; + // case HOME7: + // robot = &home7; + // break; + // case HOME8: + // robot = &home8; + // break; + // case HOME9: + // robot = &home9; + // break; + // case HOME10: + // robot = &home10; + // break; + // } + // adou[u] = atwo(robot->position.x, robot->position.y, ball.position.x, ball.position.y, pos[i].x, pos[i].y, ball.position.x, ball.position.y); // 先将值赋给adou + // pp[u] = u; + // } + + // // 然后求adou里最小的,给pos[1]的坐标,并将球员号计入xz中 + // for (int u = 1; u <= 10; u++) + // for (int j = u + 1; j <= 10; j++) + // if (adou[u] > adou[j]) { + // double t; + // int m; + // m = pp[u]; + // pp[u] = pp[j]; + // pp[j] = m; + // t = adou[u]; + // adou[u] = adou[j]; + // adou[j] = t; + // } + // for (int u = 1; u <= 10; u++) { + // int o = 0; + // for (int j = 1; j <= n; j++) { + // if (pp[u] == xz[j]) // 是记录人员 + // { + // break; + // } + // if (j == n) // 不是记录人员 + // { + // Direction(pp[u], pos[i]); + // n++; + // xz[n] = pp[u]; + // o = 1; + // } + // } + // if (o == 1) + // break; + // } + // } + // // if (Distance(pos[i], ball.position)<5) + // // PositionSE(pos[i], ball.position); // 在这个阵型这个点位处的球员就击球 + // // 否则就保持一定速度在点位待机 + } + else if (fm_id() == 8) { + Direction(cp_id(), ball.position); + + if (ball.position.x > 873) { + pos[1] = CPoint(pos[0].x + 20, pos[0].y + 15); + pos[2] = CPoint(pos[0].x + 20, pos[0].y - 15); + pos[3] = CPoint(pos[0].x + 20, pos[0].y - 30); + pos[4] = CPoint(pos[0].x - 20, pos[0].y - 20); + pos[5] = CPoint(pos[0].x + 20, pos[0].y + 30); + pos[6] = CPoint(pos[0].x - 40, pos[0].y - 20); + pos[7] = CPoint(896, 608); + pos[8] = CPoint(919, 608); + pos[9] = CPoint(942, 608); + } + else { + pos[1] = CPoint(pos[0].x, pos[0].y + 20); + pos[2] = CPoint(pos[0].x + 10, pos[0].y - 20); + pos[6] = CPoint(pos[0].x - 25, pos[0].y - 30); + pos[5] = CPoint(pos[0].x - 40, pos[0].y - 30); + pos[4] = CPoint(pos[0].x + 10, pos[0].y - 50); + pos[3] = CPoint(pos[0].x + 50, pos[0].y + 10); + int n1 = 643 > ball.position.x ? 643 : ball.position.x; + int n2 = 733 > ball.position.x ? 733 : ball.position.x; + pos[7] = CPoint(n1, 608); + pos[8] = CPoint(n2, 608); + pos[9] = CPoint(939, 608); + } + + fp_sort(rp); + fp_sort(rp, 0, 2); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 2, 6); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + fp_sort(rp, 6, 9); + PositionSE(rp[7].id, pos[7]); + PositionSE(rp[8].id, pos[8]); + PositionSE(rp[9].id, pos[9]); + // double adou[15]; + // int xz[15]; + // int n = 1; + // xz[n] = cp_id(); + // int pp[15]; + // for (int i = 1; i <= 9; i++) // 按角度从小到大排序,然后最小的占据点位,并且后续将已分配的记名,不参与接下来的分配 + // { + + // for (int u = 1; u <= 10; u++) { + // Robot2 *robot; + // switch (u) { + // case HOME1: + // robot = &home1; + // break; + // case HOME2: + // robot = &home2; + // break; + // case HOME3: + // robot = &home3; + // break; + // case HOME4: + // robot = &home4; + // break; + // case HOME5: + // robot = &home5; + // break; + // case HOME6: + // robot = &home6; + // break; + // case HOME7: + // robot = &home7; + // break; + // case HOME8: + // robot = &home8; + // break; + // case HOME9: + // robot = &home9; + // break; + // case HOME10: + // robot = &home10; + // break; + // } + // adou[u] = atwo(robot->position.x, robot->position.y, ball.position.x, ball.position.y, pos[i].x, pos[i].y, ball.position.x, ball.position.y); // 先将值赋给adou + // pp[u] = u; + // } + // // 然后求adou里最小的,给pos[1]的坐标,并将球员号计入xz中 + // for (int u = 1; u <= 10; u++) + // for (int j = u + 1; j <= 10; j++) + // if (adou[u] > adou[j]) { + // double t; + // int m; + // m = pp[u]; + // pp[u] = pp[j]; + // pp[j] = m; + // t = adou[u]; + // adou[u] = adou[j]; + // adou[j] = t; + // } + // for (int u = 1; u <= 10; u++) { + // int o = 0; + // for (int j = 1; j <= n; j++) { + // if (pp[u] == xz[j]) // 是记录人员 + // { + // break; + // } + // if (j == n) // 不是记录人员 + // { + // Direction(pp[u], pos[i]); + // n++; + // xz[n] = pp[u]; + // o = 1; + // } + // } + // if (o == 1) + // break; + // } + // } + // // if (Distance(pos[i], ball.position)<5) + // // PositionSE(pos[i], ball.position);//在这个阵型这个点位处的球员就击球 + // // 否则就保持一定速度在点位待机 + } + else if (fm_id() == 9) { + Direction(cp_id(), ball.position); + if (ball.position.y > 409) { + pos[1].y = pos[0].y - 35; + pos[1].x = pos[0].x - 10; + pos[2].y = pos[0].y - 25; + pos[2].x = pos[0].x + 30; + pos[3].y = pos[0].y; + pos[3].x = pos[0].x + 30; + pos[4].y = pos[0].y - 65; + pos[4].x = pos[0].x; + pos[5].y = pos[0].y - 75; + pos[5].x = pos[0].x + 60; + pos[6].y = pos[0].y - 60; + pos[6].x = pos[0].x + 70; + pos[7].y = pos[0].y + 20; + pos[7].x = pos[0].x + 70; + pos[8].y = pos[0].y + 60; + pos[8].x = pos[0].x + 70; + pos[9].y = pos[0].y - 90; + pos[9].x = pos[0].x + 07; + } + else if (ball.position.y <= 409) { + pos[1].y = pos[0].y; + pos[1].x = pos[0].x + 30; + pos[2].y = pos[0].y + 35; + pos[2].x = pos[0].x - 40; + pos[3].y = pos[0].y + 25; + pos[3].x = pos[0].x; + pos[4].y = pos[0].y + 65; + pos[4].x = pos[0].x + 70; + pos[5].y = pos[0].y + 75; + pos[5].x = pos[0].x + 60; + pos[6].y = pos[0].y + 65; + pos[6].x = pos[0].x + 70; + pos[7].y = pos[0].y + 20; + pos[7].x = pos[0].x + 70; + pos[8].y = pos[0].y - 20; + pos[8].x = pos[0].x + 70; + pos[9].y = pos[0].y + 90; + pos[9].x = pos[0].x + 70; + } + if (ball.position.x >= 800) { // 球临近禁区 + fp_sort(rp); + fp_sort(rp, 0, 3); + PositionSE(rp[1].id, pos[1]); + PositionSE(rp[2].id, pos[2]); + PositionSE(rp[3].id, pos[3]); + fp_sort(rp, 3, 8); + PositionSE(rp[4].id, pos[4]); + PositionSE(rp[5].id, pos[5]); + PositionSE(rp[6].id, pos[6]); + PositionSE(rp[7].id, pos[7]); + PositionSE(rp[8].id, pos[8]); + fp_sort(rp, 8, 9); + PositionSE(rp[9].id, pos[9]); + } + else { + fp_sort(rp); + fp_sort(rp, 0, 3); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + Direction(rp[3].id, pos[3]); + fp_sort(rp, 3, 8); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + Direction(rp[6].id, pos[6]); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + fp_sort(rp, 8, 9); + Direction(rp[9].id, pos[9]); + } + } + } + else { // TODO 无中央球员 + if (fm_id() == 4 || fm_id() == 6) { + pos[0] = CPoint(ball.position.x + (int)cos(0 * PI / 180) * 40, ball.position.y + (int)sin(20 * PI / 180) * 40); + pos[1] = CPoint(ball.position.x + (int)cos(45.0 * PI / 180.0) * 20, ball.position.y + (int)sin(45.0 * PI / 180.0) * 20); + pos[2] = CPoint(ball.position.x + (int)cos(90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(90.0 * PI / 180.0) * 20); + pos[3] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); + pos[4] = CPoint(pos[0].x + (int)cos(15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(15.0 * PI / 180.0) * 40); + pos[5] = CPoint(pos[0].x + (int)cos(30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(30.0 * PI / 180.0) * 40); + pos[6] = CPoint(pos[0].x + (int)cos(45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(45.0 * PI / 180.0) * 40); + pos[7] = CPoint(pos[0].x + (int)cos(50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(50.0 * PI / 180.0) * 60); + pos[8] = CPoint(pos[0].x + (int)cos(60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(60.0 * PI / 180.0) * 60); + pos[9] = CPoint(pos[0].x + (int)cos(75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(75.0 * PI / 180.0) * 60); + + fp_sort(rp); + fp_sort(rp, 0, 3); + Direction(rp[0].id, pos[0]); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 3, 6); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + fp_sort(rp, 6, 10); + Direction(rp[6].id, pos[6]); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + else if (fm_id() == 5) { + pos[0] = CPoint(ball.position.x + (int)cos(0 * PI / 180) * 40, ball.position.y - (int)sin(20 * PI / 180) * 40); + pos[1] = CPoint(ball.position.x + (int)cos(0.0 * PI / 180.0) * 20, ball.position.y + (int)sin(0.0 * PI / 180.0) * 20); + pos[2] = CPoint(ball.position.x + (int)cos(-90.0 * PI / 180.0) * 20, ball.position.y + (int)sin(-90.0 * PI / 180.0) * 20); + pos[3] = CPoint(pos[0].x + (int)cos(0.0 * PI / 180.0) * 40, pos[0].y + (int)sin(0.0 * PI / 180.0) * 40); + pos[4] = CPoint(pos[0].x + (int)cos(-15.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-15.0 * PI / 180.0) * 40); + pos[5] = CPoint(pos[0].x + (int)cos(-30.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-30.0 * PI / 180.0) * 40); + pos[6] = CPoint(pos[0].x + (int)cos(-45.0 * PI / 180.0) * 40, pos[0].y + (int)sin(-45.0 * PI / 180.0) * 40); + pos[7] = CPoint(pos[0].x + (int)cos(-50.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-50.0 * PI / 180.0) * 60); + pos[8] = CPoint(pos[0].x + (int)cos(-60.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-60.0 * PI / 180.0) * 60); + pos[9] = CPoint(pos[0].x + (int)cos(-75.0 * PI / 180.0) * 60, pos[0].y + (int)sin(-75.0 * PI / 180.0) * 60); + + fp_sort(rp); + fp_sort(rp, 0, 3); + Direction(rp[0].id, pos[0]); + Direction(rp[1].id, pos[1]); + Direction(rp[2].id, pos[2]); + fp_sort(rp, 3, 6); + Direction(rp[3].id, pos[3]); + Direction(rp[4].id, pos[4]); + Direction(rp[5].id, pos[5]); + fp_sort(rp, 6, 10); + Direction(rp[6].id, pos[6]); + Direction(rp[7].id, pos[7]); + Direction(rp[8].id, pos[8]); + Direction(rp[9].id, pos[9]); + } + } +} + +// 搜索最近球员位置 +// CPoint CStrategySystem::searchNear(int which) { +// CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; +// double ddd = 10000; +// CPoint near; +// for (int i = 0; i < 10; i++) { +// if (Distance(cur_pos[i], ball.position) < ddd) { +// ddd = Distance(cur_pos[i], ball.position); +// near = cur_pos[i]; +// } +// } +// return near; +// } + +// 中央球员 ID +int CStrategySystem::cp_id() { + int id = 0; + CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position }; + if (fm_id() == 1) { + for (int i = 0; i < 10; i++) { + if (cur_pos[i].y >= ball.position.y) + cur_pos[i] = CPoint(-965, -723); + } + double min = 10000; + for (int i = 0; i < 10; i++) { + if (Distance(cur_pos[i], ball.position) < min) { + min = Distance(cur_pos[i], ball.position); + id = i + 1; + } + } + } + else if (fm_id() == 2) { + for (int i = 0; i < 10; i++) { + if (cur_pos[i].y <= ball.position.y) + cur_pos[i] = CPoint(-965, -723); + } + double min = 10000; + for (int i = 0; i < 10; i++) { + if (Distance(cur_pos[i], ball.position) < min) { + min = Distance(cur_pos[i], ball.position); + id = i + 1; + } + } + } + else if (fm_id() == 7) { + for (int i = 0; i < 10; i++) { + if (cur_pos[i].y <= ball.position.y) + cur_pos[i] = CPoint(-965, -723); + } + double min = 10000; + for (int i = 0; i < 10; i++) { + if (Distance(cur_pos[i], ball.position) < min) { + min = Distance(cur_pos[i], ball.position); + id = i + 1; + } + } + } + else if (fm_id() == 8) { + for (int i = 0; i < 10; i++) { + if (cur_pos[i].y >= ball.position.y) + cur_pos[i] = CPoint(-965, -723); + } + double min = 10000; + for (int i = 0; i < 10; i++) { + if (Distance(cur_pos[i], ball.position) < min) { + min = Distance(cur_pos[i], ball.position); + id = i + 1; + } + } + } + else if (fm_id() == 3) { + if (ball.position.x >= 157 && ball.position.x <= 290) { + for (int i = 0; i < 10; i++) { + if (cur_pos[i].x < ball.position.x) + cur_pos[i] = CPoint(-965, -723); + } + double min = 10000; + for (int i = 0; i < 10; i++) { + if (Distance(cur_pos[i], ball.position) < min) { + min = Distance(cur_pos[i], ball.position); + id = i + 1; + } + } + } + else if (ball.position.x >= 65 && ball.position.x < 157) // 球在禁区用y轴最近 + { + double min = 10000; + for (int i = 0; i < 10; i++) { + if (cur_pos[i].x < ball.position.x) + cur_pos[i] = CPoint(-965, -723); + } + for (int i = 0; i < 10; i++) { + if (fabs(ball.position.y - cur_pos[i].y) < min) { + min = fabs(ball.position.y - cur_pos[i].y); + id = i + 1; + } + } + } + } + else { + for (int i = 0; i < 10; i++) { + if (cur_pos[i].x <= ball.position.x) + cur_pos[i] = CPoint(-965, -723); + } + double min = 10000; + for (int i = 0; i < 10; i++) { + if (Distance(cur_pos[i], ball.position) < min) { + min = Distance(cur_pos[i], ball.position); + id = i + 1; + } + } + } + return id; +} + +// 阵型 ID +int CStrategySystem::fm_id() { + if (ball.position.x < 290) { + if (ball.position.y < 217) + return 1; + else if (ball.position.y <= 607) + return 3; + else + return 2; + } + else if (ball.position.x < 740) { + if (ball.position.y < 217) + return 4; + else if (ball.position.y <= 607) + return 6; + else + return 5; + } + else { + if (ball.position.y < 217) + return 7; + else if (ball.position.y <= 607) + return 9; + else + return 8; + } +} + +// 阵型球员相对中央球员的位置结构体 +// struct RelPos { +// int id; +// double dis; +// double ang; // (-π, π] +// }; + +// 阵型球员排序,h 为该层前的球员数量,t 为包含该层后的球员数量 +void CStrategySystem::fp_sort(RelPos *rp, int h, int t) { + RelPos r; + if (!h && !t) { + for (int i = 1; i < 10; i++) { + for (int j = 0; j < 10 - i; j++) { + if (rp[j].dis > rp[j + 1].dis) { + r = rp[j], rp[j] = rp[j + 1], rp[j + 1] = r; + } + } + } + } + else { + for (int i = h + 1; i < t; i++) { + for (int j = h; j < t - i; j++) { + if (rp[j].ang > rp[j + 1].ang) { + r = rp[j], rp[j] = rp[j + 1], rp[j + 1] = r; + } + } + } + } +} + +// 返回机器人的位置 +CPoint CStrategySystem::coor(int which) { + Robot2 *robot; + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + return robot->position; +} + +// 0向下门框射 +void CStrategySystem::shot(int which) { + Robot2 *robot; + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + bool de; + if (ball.position.y > robot->position.y) + de = 0; + else + de = 1; + double O, O1; + CPoint t1, t2, t3, t4; // t1球,t2机器人,t3机器人要移动到的点,t4门 + t1.x = ball.position.x; + t1.y = ball.position.y; + if (de == 0) { + t4.x = 33.0; + t4.y = 505.0; + O = atan(fabs(ball.position.y - t4.y) / fabs(ball.position.x - t4.x)); // fabs(Angle(,t4)); + O1 = 180 - O; + t3.x = t1.x + cos(O) * 34; + t3.y = t1.y - sin(O) * 34; + } + else if (de == 1) { + t4.x = 33.0; + t4.y = 313.0; + O = atan(fabs(ball.position.y - t4.y) / fabs(ball.position.x - t4.x)); // fabs(Angle(ball.position,t4)); + O1 = 180 + O; + t3.x = t1.x + cos(O) * 34; + t3.y = t1.y + sin(O) * 34; + } + if (Distance(robot->position, ball.position) <= 35 && (fabs(Angle(ball.position, t3) - Angle(robot->position, t3))) <= 2) { + if (de == 1) { + t3.x = t1.x - cos(O) * 34; + t3.y = t1.y - sin(O) * 34; + Direction(which, t3); + } + else if (de == 0) { + t3.x = t1.x - cos(O) * 34; + t3.y = t1.y + sin(O) * 34; + Direction(which, t3); + } + } + else + Position(which, t3); // 机器人到足够近的点t3 +} + +// 射? +bool CStrategySystem::canshot() { + bool t; // 判断球在敌方上半还是下半;0为下半 + CPoint D1, D2, t4; + Robot2 *robot9, *robot10; + robot9 = &home9; + robot10 = &home10; + // if (ball.position.y >= 409 && ball.position.x <= 290&&ball.position.y<=607) // 球在敌方下半 + // { + // t = 0; + // D1.x = 170; + // D1.y = 265; + // Position(HOME10, D1); + // D2.x = 170; + // D2.y = 409; + // Position(HOME9, D2); + // } + // else if (ball.position.y < 409 && ball.position.x < 290 && ball.position.y >= 217 && Distance(ball.position, home10.position) > 168) // 球在敌方上半 + // { + // t = 1; + // D1.x = 170; + // D1.y = 556; + // Position(HOME10, D1); + // D2.x = 170; + // D2.y = 409; + // Position(HOME9, D2); + // if (ball.position.x >= 104 && ball.position.x <= 170 && ball.position.y >= 313 && ball.position.y <= 449 && (ball.oldPosition.y - ball.oldPosition.y) <= 0) + // Shot(HOME9, 1); + // if (ball.position.x >= 104 && ball.position.x <= 170 && ball.position.y > 449 && ball.position.y <= 607 && (ball.oldPosition.y - ball.oldPosition.y) <= 0) + // Shot(HOME10, 1); + // } + if (ball.position.y <= 481) // 敌方框上半场 + { + D1.x = 170; + D1.y = 265; + D2.x = 170; + D2.y = 409; + if (Distance(ball.position, home9.position) <= 116 && ball.position.y >= 409 && ball.position.y <= 481) // 9可射 + { + shot(HOME9, 0); + Direction(HOME10, D1); + } + else if (Distance(ball.position, home10.position) <= 168 && ball.position.y < 409 && ball.position.y >= 265) // 10可射 + { + Direction(HOME9, D2); + shot(HOME10, 0); + } + else { // 9,10到预定位置 + Direction(HOME10, D1); + Direction(HOME9, D2); + } + return 1; + } + else if (ball.position.y >= 337) // 敌方框下半场 + { + D1.x = 170; + D1.y = 556; + D2.x = 170; + D2.y = 409; + if (Distance(ball.position, home9.position) <= 116 && ball.position.y <= 409 && ball.position.y >= 337) // 9可射 + { + shot(HOME9, 1); + Direction(HOME10, D1); + } + else if (Distance(ball.position, home10.position) <= 164 && ball.position.y > 409 && ball.position.y <= 556) // 10可射 + { + Direction(HOME9, D2); + shot(HOME10, 1); + } + else { // 9,10到预定位置 + Direction(HOME10, D1); + Direction(HOME9, D2); + } + return 1; + } + return 0; + // if () + // { + // if (ball.position.y <= 170) { + // Position(HOME10, D1); + // Shot(HOME9, 0); + // } + // else if (ball.position.y >= 170) { + // Position(HOME9, D2); + // Shot(HOME10, 0); + // } + // } + // else { + // Position(HOME10, D1); + // Position(HOME9, D2); + // } +} + +// 把球向t点射,de向上还是向下射 +void CStrategySystem::shot(int which, CPoint t) { + Robot2 *robot; + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + bool de; + if (ball.position.y > robot->position.y) + de = 0; + else + de = 1; + double O; + CPoint t1, t2, t3; // t1球,t2机器人,t3机器人要移动到的点 + t1.x = ball.position.x; + t1.y = ball.position.y; + if (de == 0) { + O = atan(fabs(ball.position.y - t.y) / fabs(ball.position.x - t.x)); + if (ball.position.x <= 515) { + t3.x = t1.x + cos(O) * 34; + t3.y = t1.y - sin(O) * 34; + } + else { + t3.x = t1.x - cos(O) * 34; + t3.y = t1.y - sin(O) * 34; + } + } + else if (de == 1) { + O = atan(fabs(ball.position.y - t.y) / fabs(ball.position.x - t.x)); // fabs(Angle(ball.position,t4)); + if (ball.position.x <= 515) { + t3.x = t1.x + cos(O) * 34; + t3.y = t1.y + sin(O) * 34; + } + else { + t3.x = t1.x - cos(O) * 34; + t3.y = t1.y + sin(O) * 34; + } + } + if (Distance(robot->position, ball.position) <= 35 && (fabs(Angle(ball.position, t3) - Angle(robot->position, t3))) <= 2) { + if (de == 1) { + t3.x = t1.x - cos(O) * 34; + t3.y = t1.y - sin(O) * 34; + Direction(which, t3); + } + else if (de == 0) { + t3.x = t1.x - cos(O) * 34; + t3.y = t1.y + sin(O) * 34; + Direction(which, t3); + } + } + else + Position(which, t3); // 机器人到足够近的点t3 +} + +// 直射 +void CStrategySystem::shot1(int which, double o, CPoint t) { + Robot2 *robot; + switch (which) { + case HOME9: + robot = &home9; + break; + case HOME1: + robot = &home1; + break; + } + bool a = 0; + /*if((fabs(Angle(ball.position, t) - Angle(robot->position, t))) > 5)*/ + Angle(which, o); + Velocity(which, 127, 127); // which全速前进 +} + +/*void banarea(int which) //让9,10不进禁区 +{ + Robot2 *robot; + switch (which) { + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + } + CPoint t1, t2;//t1球 + t1.x = ball.position.x; + t1.y = ball.position.y; + t2.x = robot->position.x; + t2.y = robot->position.y; + if((t1.x>=65&&1.x<=103&&t1.y>=247&&t1.y<=577)||(t2.x+1==)) +}*/ + +// void CStrategySystem::navigate() // 给人要去的位置坐标导航(预判) +// { +// CPoint robot[11]; +// robot[1] = home1.position; +// robot[2] = home2.position; +// robot[3] = home3.position; +// robot[4] = home4.position; +// robot[5] = home5.position; +// robot[6] = home6.position; +// robot[7] = home7.position; +// robot[8] = home8.position; +// robot[9] = home9.position; +// robot[10] = home10.position; +// /*double d[11]; +// d[1] = Distance(ball.position, home1.position); +// d[2] = Distance(ball.position, home2.position); +// d[3] = Distance(ball.position, home3.position); +// d[4] = Distance(ball.position, home4.position); +// d[5] = Distance(ball.position, home5.position); +// d[6] = Distance(ball.position, home6.position); +// d[7] = Distance(ball.position, home7.position); +// d[8] = Distance(ball.position, home8.position); +// d[9] = Distance(ball.position, home9.position); +// d[10] = Distance(ball.position, home10.position);*/ +// if (65 < ball.position.x && ball.position.x <= 515) { + +// // 对方罚球区内,包围门框 +// if (ball.position.x <= 160 && ball.position.y <= 600 && ball.position.y >= 210) { + +// Navigation[1] = CPoint(175, ball.position.y); +// Navigation[2] = CPoint(175, ball.position.y + 20); +// Navigation[3] = CPoint(175, ball.position.y - 20); +// Navigation[4] = CPoint(200, ball.position.y); +// Navigation[5] = CPoint(175, ball.position.y + 30); +// Navigation[6] = CPoint(200, ball.position.y - 30); +// Navigation[7] = CPoint(ball.position.x, 610); +// Navigation[8] = CPoint(ball.position.x, 210); +// Navigation[9] = CPoint(220, ball.position.y + 50); +// Navigation[10] = CPoint(220, ball.position.y - 50); +// } +// // 对方下半场 +// else if (ball.position.y >= 607) { +// if (home1.position.x > ball.position.x) { // 球员在右 +// if (home1.position.y > ball.position.y) { // 球员在右下 +// Navigation[1] = ball.position; +// } +// else { // 球员在右下 +// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y + 10); +// } +// } +// else { // 球员在左 +// if (home1.position.y > ball.position.y) { // 左下 +// Navigation[1] = ball.position; +// } +// else { // 左上 +// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y + 10); +// } +// } +// if (home2.position.x > ball.position.x) { +// if (home2.position.y > ball.position.y) { +// Navigation[2] = ball.position; +// } +// else { +// Navigation[2] = CPoint(ball.position.x + 10, ball.position.y + 20); +// } +// } +// else { +// if (home2.position.y > ball.position.y) { +// Navigation[2] = ball.position; +// } +// else { +// Navigation[2] = CPoint(ball.position.x - 10, ball.position.y - 20); +// } +// } +// if (home3.position.x > ball.position.x) { +// if (home3.position.y > ball.position.y) { +// Navigation[3] = ball.position; +// } +// else { +// Navigation[3] = CPoint(ball.position.x + 20, ball.position.y + 10); +// } +// } +// else { +// if (home3.position.y > ball.position.y) { +// Navigation[3] = ball.position; +// } +// else { +// Navigation[3] = CPoint(ball.position.x - 20, ball.position.y - 10); +// } +// } +// Navigation[4] = CPoint(ball.position.x + 50, ball.position.y + 50); +// Navigation[5] = CPoint(ball.position.x + 50, ball.position.y); +// Navigation[6] = CPoint(ball.position.x + 50, ball.position.y - 50); +// Navigation[7] = CPoint(ball.position.x, ball.position.y + 50); +// Navigation[8] = CPoint(ball.position.x - 50, ball.position.y + 50); +// Navigation[9] = CPoint(ball.position.x + 80, ball.position.y); +// Navigation[10] = CPoint(ball.position.x + 80, ball.position.y + 50); +// //// Navigate(ball.position); +// //// 机器人在球右下 +// // if (robot->position.y <= ball.position.y && robot->position.x >= ball.position.x) { +// // Direction(which, ball.position); +// // // Velocity(which, 127, 127); +// // } +// //// 机器人在球右上 +// // else if (robot->position.y > ball.position.y && robot->position.x > ball.position.x) { +// // Direction(which, CPoint(ball.position.x + 10, ball.position.y)); +// // // Velocity(which, vL, vR); +// // } +// //// 机器人在球左上 +// // else if (robot->position.y < ball.position.y && robot->position.x < ball.position.x) { +// // // Position(which, CPoint(ball.)); +// // } +// //// 机器人在球左下 +// // else { +// // Direction(which, CPoint(ball.position.x - 20, ball.position.y)); +// // } +// } +// // 对方中场 +// else if (ball.position.y >= 217 && ball.position.y < 607) { +// if (home1.position.x > ball.position.x) { +// if (home1.position.y < ball.position.y) { +// Navigation[1] = ball.position; +// } +// else { +// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y - 10); +// } +// } +// else { +// if (home1.position.y < ball.position.y) { +// Navigation[1] = CPoint(ball.position.x, ball.position.y - 10); +// } +// else { +// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y - 10); +// } +// } +// if (home2.position.x > ball.position.x) { +// if (home2.position.y < ball.position.y) { +// Navigation[2] = ball.position; +// } +// else { +// Navigation[2] = CPoint(ball.position.x + 20, ball.position.y + 10); +// } +// } +// else { +// if (home2.position.y < ball.position.y) { +// Navigation[1] = CPoint(ball.position.x, ball.position.y - 15); +// } +// else { +// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y - 15); +// } +// } +// if (home3.position.x > ball.position.x) { +// if (home3.position.y < ball.position.y) { +// Navigation[3] = ball.position; +// } +// else { +// Navigation[3] = CPoint(ball.position.x + 10, ball.position.y + 20); +// } +// } +// else { +// if (home3.position.y < ball.position.y) { +// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y - 15); +// } +// else { +// Navigation[1] = CPoint(ball.position.x - 15, ball.position.y - 10); +// } +// } +// Navigation[4] = CPoint(ball.position.x, ball.position.y - 60); +// Navigation[5] = CPoint(ball.position.x + 50, ball.position.y - 60); +// Navigation[6] = CPoint(ball.position.x + 60, ball.position.y - 50); +// Navigation[7] = CPoint(ball.position.x + 60, ball.position.y + 50); +// Navigation[8] = CPoint(ball.position.x + 60, ball.position.y + 70); +// Navigation[9] = CPoint(ball.position.x + 70, ball.position.y - 60); +// Navigation[10] = CPoint(ball.position.x + 70, ball.position.y - 60); +// //// 机器人在球的右下 +// // if (robot->position.x >= ball.position.x && robot->position.y <= ball.position.y) { +// // Direction(which, ball.position); +// // } +// //// 机器人在球右上 +// // else if (robot->position.x > ball.position.x && robot->position.y > ball.position.y) { +// // // 右上且距离较远 +// // if (robot->position.y >= ball.position.y + 100) { +// // Direction(which, CPoint(ball.position.x + 20, ball.position.y + 20)); +// // } +// // // 距离较近 +// // else { +// // Direction(which, CPoint(ball.position.x + 10, ball.position.y)); +// // } +// // } +// //// 机器人在球左下 +// // else if (robot->position.x <= ball.position.x && robot->position.y >= ball.position.y) { +// // Direction(which, CPoint(ball.position.x - 20, ball.position.y + 20)); +// // } +// //// 机器人在球左上 +// // else { +// // Direction(which, CPoint(ball.position.x - 20, ball.position.y - 20)); +// // } +// } +// // 上场 +// else { +// if (home1.position.x > ball.position.x) { +// if (home1.position.y < ball.position.y) { +// Navigation[1] = ball.position; +// } +// else { +// Navigation[1] = CPoint(ball.position.x + 10, ball.position.y - 10); +// } +// } +// else { +// if (home1.position.y < ball.position.y) { +// Navigation[1] = CPoint(ball.position.x, ball.position.y - 10); +// } +// else { +// Navigation[1] = CPoint(ball.position.x - 10, ball.position.y - 10); +// } +// } +// if (home2.position.x > ball.position.x) { +// if (home2.position.y < ball.position.y) { +// Navigation[2] = ball.position; +// } +// else { +// Navigation[2] = CPoint(ball.position.x + 10, ball.position.y); +// } +// } +// else { +// if (home2.position.y < ball.position.y) { +// Navigation[2] = CPoint(ball.position.x - 5, ball.position.y - 10); +// } +// else { +// Navigation[2] = CPoint(ball.position.x - 10, ball.position.y - 10); +// } +// } +// if (home3.position.x > ball.position.x) { +// if (home3.position.y < ball.position.y) { +// Navigation[3] = ball.position; +// } +// else { +// Navigation[3] = CPoint(ball.position.x + 10, ball.position.y - 15); +// } +// } +// else { +// if (home2.position.y < ball.position.y) { +// Navigation[3] = CPoint(ball.position.x - 5, ball.position.y - 10); +// } +// else { +// Navigation[3] = CPoint(ball.position.x - 10, ball.position.y - 10); +// } +// } +// Navigation[4] = CPoint(ball.position.x - 50, ball.position.y - 50); +// Navigation[5] = CPoint(ball.position.x, ball.position.y - 50); +// Navigation[6] = CPoint(ball.position.x + 50, ball.position.y - 50); +// Navigation[7] = CPoint(ball.position.x + 50, ball.position.y); +// Navigation[8] = CPoint(ball.position.x + 60, ball.position.y + 50); +// Navigation[9] = CPoint(ball.position.x + 70, ball.position.y + 60); +// Navigation[10] = CPoint(ball.position.x + 70, ball.position.y + 70); +// // 机器人在球右上 +// // if (robot->position.x >= ball.position.x && robot->position.y <= ball.position.y) { +// // Direction(which, ball.position); +// //} +// //// 机器人在球右下 +// // else if (robot->position.x >= ball.position.x && robot->position.y > ball.position.y) { +// // Direction(which, CPoint(ball.position.x + 20, ball.position.y)); +// // } +// //// 机器人在球左上 +// // else if (robot->position.x < ball.position.x && robot->position.y >= ball.position.y) { +// // Direction(which, CPoint(ball.position.x - 20, ball.position.y)); +// // } +// //// 机器人在左下 +// // else { +// // } +// } +// } +// // 防守区域(在己方罚球区外) +// else if (ball.position.x > 515 && ball.position.x < 965) { +// CPoint goal; +// double l; + +// // 己方上半场 +// goal.x = ball.position.x; +// goal.y = 95; +// l = Distance(ball.position, goal); +// if (ball.position.y < 217 && ball.position.y >= 95) { +// Navigation[1].x = ball.position.x; +// Navigation[1].y = 95 + (int)l + 5; +// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[2].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[4].x = ball.position.x; +// Navigation[4].y = 95 + (int)l + 15; +// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[5].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[9].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// } +// // 己方中场 +// else if (ball.position.y > 217 && ball.position.y <= 607) { +// // 球在中场上侧,要把球往上压 +// if (ball.position.y < 409) { +// Navigation[1].x = ball.position.x; +// Navigation[1].y = 95 + (int)l + 5; +// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[2].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].y = 95 + (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[4].x = ball.position.x; +// Navigation[4].y = 95 + (int)l + 15; +// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[5].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].y = 95 + (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].y = 95 + (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[9].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].y = 95 + (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// } +// // 球在中场下侧,要把球往下压 + +// else { +// goal.x = ball.position.x; +// goal.y = 723; +// l = Distance(ball.position, goal); +// Navigation[1].x = ball.position.x; +// Navigation[1].y = 723 - (int)l - 5; +// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[2].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[4].x = ball.position.x; +// Navigation[4].y = 723 - (int)l - 15; +// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[5].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[9].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// } +// } +// // 己方下半场 + +// else if (ball.position.y > 607) { +// goal.x = ball.position.x; +// goal.y = 723; +// l = Distance(ball.position, goal); +// Navigation[1].x = ball.position.x; +// Navigation[1].y = 723 - (int)l - 5; +// Navigation[2].x = ball.position.x - (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[2].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].x = ball.position.x + (int)sin(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[3].y = 723 - (int)cos(15.0 * PI / 180.0) * ((int)l + 5); +// Navigation[4].x = ball.position.x; +// Navigation[4].y = 723 - (int)l - 15; +// Navigation[5].x = ball.position.x - (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[5].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].x = ball.position.x + (int)sin(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[6].y = 723 - (int)cos(25.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].x = ball.position.x - (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[7].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].x = ball.position.x + (int)sin(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[8].y = 723 - (int)cos(45.0 * PI / 180.0) * ((int)l + 15); +// Navigation[9].x = ball.position.x - (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[9].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].x = ball.position.x + (int)sin(30.0 * PI / 180.0) * ((int)l + 25); +// Navigation[10].y = 723 - (int)cos(30.0 * PI / 180.0) * ((int)l + 25); +// } +// } +// for (int i = 1; i < 11; i++) // 己方禁区处理 +// { +// int kx, ky, x1, x2; +// if (Navigation[i].x > 873 && Navigation[i].y < 607 && Navigation[i].y > 217) // 导航定位不进禁区 +// { +// if (ball.position.x > 873) { +// if (ball.position.y > 607) +// Navigation[i].y = 607; +// if (ball.position.y < 217) +// Navigation[i].y = 217; +// } +// else { +// Navigation[i].x = 873; +// } +// } +// else if (Navigation[i].x > 873 && Navigation[i].y > 607) // 行走路径不进禁区 +// { +// if (robot[i].x < 873 && robot[i].y < 607 && robot[i].y > 217) { +// ky = abs((Navigation[i].y - robot[i].y) / (Navigation[i].x - robot[i].x)); +// x1 = abs((873 - robot[i].x) * ky); +// x2 = abs(607 - robot[i].y); +// if (x2 > x1) { +// Navigation[i].y = robot[i].y + x1; +// Navigation[i].x = 873; +// } +// } +// } +// else if (Navigation[i].x > 873 && Navigation[i].y < 217) { +// if (robot[i].x < 873 && robot[i].y < 607 && robot[i].y > 217) { +// ky = abs((Navigation[i].y - robot[i].y) / (Navigation[i].x - robot[i].x)); +// x1 = abs((873 - robot[i].x) * ky); +// x2 = abs(217 - robot[i].y); +// if (x2 > x1) { +// Navigation[i].y = robot[i].y - x1; +// Navigation[i].x = 873; +// } +// } +// } +// else if (Navigation[i].x < 873 && Navigation[i].y > 217) { +// if (robot[i].x > 873 && robot[i].y < 217) { +// kx = abs((Navigation[i].x - robot[i].x) / (Navigation[i].y - robot[i].y)); +// x1 = abs((217 - robot[i].y) * kx); +// x2 = abs(873 - robot[i].x); +// if (x2 > x1) { +// Navigation[i].y = 217; +// Navigation[i].x = robot[i].x - x1; +// } +// } +// } +// else if (Navigation[i].x < 873 && Navigation[i].y < 607) { +// if (robot[i].x > 873 && robot[i].y > 607) { +// kx = abs((Navigation[i].x - robot[i].x) / (Navigation[i].y - robot[i].y)); +// x1 = abs((607 - robot[i].y) * kx); +// x2 = abs(873 - robot[i].x); +// if (x2 > x1) { +// Navigation[i].y = 607; +// Navigation[i].x = robot[i].x - x1; +// } +// } +// } +// } +// } + +// void CStrategySystem::control(int which) { +// Robot2 *robot; +// // switch (which) { +// // case HOME1: +// // robot = &home1; +// // break; +// // case HOME2: +// // robot = &home2; +// // break; +// // case HOME3: +// // robot = &home3; +// // break; +// // case HOME4: +// // robot = &home4; +// // break; +// // case HOME5: +// // robot = &home5; +// // break; +// // case HOME6: +// // robot = &home6; +// // break; +// // case HOME7: +// // robot = &home7; +// // break; +// // case HOME8: +// // robot = &home8; +// // break; +// // case HOME9: +// // robot = &home9; +// // break; +// // case HOME10: +// // robot = &home10; +// // break; +// // case HGOALIE: +// // robot = &hgoalie; +// // break; +// // } +// PositionSE(which, Navigation[which]); +// } + +// 查找在大区里的机器人 +int CStrategySystem::search1() { + int sum = 0; + if ((home1.position.x >= 105 && home1.position.x <= 157 && home1.position.y >= 247 && home1.position.y <= 577) || (home1.position.x >= 65 && home1.position.x <= 157 && home1.position.y >= 217 && home1.position.y <= 247) || (home1.position.x >= 65 && home1.position.x <= 157 && home1.position.y >= 577 && home1.position.y <= 607)) + sum++; + if ((home2.position.x >= 105 && home2.position.x <= 157 && home2.position.y >= 247 && home2.position.y <= 577) || (home2.position.x >= 65 && home2.position.x <= 157 && home2.position.y >= 217 && home2.position.y <= 247) || (home2.position.x >= 65 && home2.position.x <= 157 && home2.position.y >= 577 && home2.position.y <= 607)) + sum++; + if ((home3.position.x >= 105 && home3.position.x <= 157 && home3.position.y >= 247 && home3.position.y <= 577) || (home3.position.x >= 65 && home3.position.x <= 157 && home3.position.y >= 217 && home3.position.y <= 247) || (home3.position.x >= 65 && home3.position.x <= 157 && home3.position.y >= 577 && home3.position.y <= 607)) + sum++; + if ((home4.position.x >= 105 && home4.position.x <= 157 && home4.position.y >= 247 && home4.position.y <= 577) || (home4.position.x >= 65 && home4.position.x <= 157 && home4.position.y >= 217 && home4.position.y <= 247) || (home4.position.x >= 65 && home4.position.x <= 157 && home4.position.y >= 577 && home4.position.y <= 607)) + sum++; + if ((home5.position.x >= 105 && home5.position.x <= 157 && home5.position.y >= 247 && home5.position.y <= 577) || (home5.position.x >= 65 && home5.position.x <= 157 && home5.position.y >= 217 && home5.position.y <= 247) || (home5.position.x >= 65 && home5.position.x <= 157 && home5.position.y >= 577 && home5.position.y <= 607)) + sum++; + if ((home6.position.x >= 105 && home6.position.x <= 157 && home6.position.y >= 247 && home6.position.y <= 577) || (home6.position.x >= 65 && home6.position.x <= 157 && home6.position.y >= 217 && home6.position.y <= 247) || (home6.position.x >= 65 && home6.position.x <= 157 && home6.position.y >= 577 && home6.position.y <= 607)) + sum++; + if ((home7.position.x >= 105 && home7.position.x <= 157 && home7.position.y >= 247 && home7.position.y <= 577) || (home7.position.x >= 65 && home7.position.x <= 157 && home7.position.y >= 217 && home7.position.y <= 247) || (home7.position.x >= 65 && home7.position.x <= 157 && home7.position.y >= 577 && home7.position.y <= 607)) + sum++; + if ((home8.position.x >= 105 && home8.position.x <= 157 && home8.position.y >= 247 && home8.position.y <= 577) || (home8.position.x >= 65 && home8.position.x <= 157 && home8.position.y >= 217 && home8.position.y <= 247) || (home8.position.x >= 65 && home8.position.x <= 157 && home8.position.y >= 577 && home8.position.y <= 607)) + sum++; + if ((home9.position.x >= 105 && home9.position.x <= 157 && home9.position.y >= 247 && home9.position.y <= 577) || (home9.position.x >= 65 && home9.position.x <= 157 && home9.position.y >= 217 && home9.position.y <= 247) || (home9.position.x >= 65 && home9.position.x <= 157 && home9.position.y >= 577 && home9.position.y <= 607)) + sum++; + if ((home10.position.x >= 105 && home10.position.x <= 157 && home10.position.y >= 247 && home10.position.y <= 577) || (home10.position.x >= 65 && home10.position.x <= 157 && home10.position.y >= 217 && home10.position.y <= 247) || (home10.position.x >= 65 && home10.position.x <= 157 && home10.position.y >= 577 && home10.position.y <= 607)) + sum++; + return sum; +} + +// 查找在小区里的机器人 +int CStrategySystem::search2() { + int sum = 0; + if (home1.position.x >= 65 && home1.position.x < 105 && home1.position.y >= 247 && home1.position.y <= 577) + sum++; + if (home2.position.x >= 65 && home2.position.x < 105 && home2.position.y >= 247 && home2.position.y <= 577) + sum++; + if (home3.position.x >= 65 && home3.position.x < 105 && home3.position.y >= 247 && home3.position.y <= 577) + sum++; + if (home4.position.x >= 65 && home4.position.x < 105 && home4.position.y >= 247 && home4.position.y <= 577) + sum++; + if (home5.position.x >= 65 && home5.position.x < 105 && home5.position.y >= 247 && home5.position.y <= 577) + sum++; + if (home6.position.x >= 65 && home6.position.x < 105 && home6.position.y >= 247 && home6.position.y <= 577) + sum++; + if (home7.position.x >= 65 && home7.position.x < 105 && home7.position.y >= 247 && home7.position.y <= 577) + sum++; + if (home8.position.x >= 65 && home8.position.x < 105 && home8.position.y >= 247 && home8.position.y <= 577) + sum++; + if (home9.position.x >= 65 && home9.position.x < 105 && home9.position.y >= 247 && home9.position.y <= 577) + sum++; + if (home10.position.x >= 65 && home10.position.x < 105 && home10.position.y >= 247 && home10.position.y <= 577) + sum++; + return sum; +} + +// 守门 +void CStrategySystem::Goalie() { // TODO 两侧卡顿 + if (start) + ball.oldPosition = ball.position; + // static int xit; + // if (ball.position != ball.oldPosition) + // xit = 0; + // else + // xit++; + if (ball.position.x <= hgoalie.position.x) { + int xix = ball.position.x > 950 ? 965 : 950, xiy, xii = int((double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * 965 + (ball.oldPosition.y - (double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * ball.oldPosition.x) + 0.5), xid = 2; + if (Distance(ball.position, ball.oldPosition) < 1 || ball.position.x <= ball.oldPosition.x || xii < 313 || xii > 505) { + // if (ball.position.x >= 927 && ball.position.y >= 313 && ball.position.y <= 505) { + // xiy = ball.position.y; + // if (xiy < 343 || xiy > 475) + // xix = 965; + // } + // else { + xii = int((double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * 965 + (shooter_pos().y - (double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * shooter_pos().x) + 0.5); + if (xii < 313 || xii > 505) { + xiy = int((Distance(ball.position, CPoint(863, 313)) * 192 / (Distance(ball.position, CPoint(863, 313)) + Distance(ball.position, CPoint(863, 505)))) + 313.5); + if (xiy < 343 || xiy > 475) + xix = 965; + } + else { + if (xii < 343 || xii > 475) + xix = 965; + xiy = int((double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * (xix - xid) + (shooter_pos().y - (double(ball.position.y - shooter_pos().y) / (ball.position.x - shooter_pos().x)) * shooter_pos().x) + 0.5); + } + if (ball.position.x <= 900 || ball.position.y < 313 || ball.position.y > 505) + if ((T / 4) % 2) + xiy += 30; + else + xiy -= 30; + // } + } + else { + if (xii < 343 || xii > 475) + xix = 965; + xiy = int((double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * (xix - xid) + (ball.oldPosition.y - (double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * ball.oldPosition.x) + 0.5); + } + // if (ball.position.x >= 900 && ball.position.y >= 313 && ball.position.y <= 505 && xit >= 10) // TODO 旋球 + // if (shooter_pos().y > ball.position.y) + // Direction(HGOALIE, CPoint(ball.position.x + 1, ball.position.y + 1)); + // else + // Direction(HGOALIE, CPoint(ball.position.x + 1, ball.position.y - 1)); + // else + Direction(HGOALIE, CPoint(xix, xiy)); + } + else + Stop(HGOALIE); + ball.oldPosition = ball.position; +} + +// 对方射门者位置 +CPoint CStrategySystem::shooter_pos() { + CPoint cur_pos[11]{ opponent.position1, opponent.position2, opponent.position3, opponent.position4, opponent.position5, opponent.position6, opponent.position7, opponent.position8, opponent.position9, opponent.position10, opponent.position11 }; + for (int i = 0; i < 11; i++) { + if (cur_pos[i].x >= ball.position.x) + cur_pos[i] = CPoint(-965, -723); + } + int xii = 0; + double xid = Distance(cur_pos[0], ball.position); + for (int i = 1; i < 11; i++) { + if (Distance(cur_pos[i], ball.position) < xid) { + xid = Distance(cur_pos[i], ball.position); + xii = i; + } + } + return cur_pos[xii]; +} + +double CStrategySystem::Distance(CPoint point1, CPoint point2) { + return sqrt(1.0 * (point1.x - point2.x) * (point1.x - point2.x) + 1.0 * (point1.y - point2.y) * (point1.y - point2.y)); +} + +double CStrategySystem::Angle(CPoint point1, CPoint point2) { + return atan2(1.0 * (point1.y - point2.y), 1.0 * (point1.x - point2.x)); +} + +void CStrategySystem::Direction(int which, CPoint point) { + Robot2 *robot; + double distance_e; + int dx, dy, desired_angle, theta_e, vL, vR; + + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + + point.x = 2 * point.x - robot->position.x; + point.y = 2 * point.y - robot->position.y; + + point.x = point.x < boundRect.left ? boundRect.left : point.x; + point.x = point.x > boundRect.right ? boundRect.right : point.x; + point.y = point.y < boundRect.top ? boundRect.top : point.y; + point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; + + dx = point.x - robot->position.x; + dy = point.y - robot->position.y; + + distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); + + if (dx == 0 && dy == 0) + desired_angle = 90; + else + desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); + + theta_e = desired_angle - robot->angle; + + while (theta_e > 180) + theta_e -= 360; + while (theta_e < -180) + theta_e += 360; + + if (theta_e < -90) { + theta_e += 180; + distance_e = -distance_e; + } + else if (theta_e > 90) { + theta_e -= 180; + distance_e = -distance_e; + } + + vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); + vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); + + Velocity(which, vL, vR); +} + +void CStrategySystem::PositionSE(int which, CPoint point) { + Robot2 *robot; + double distance_e; + int dx, dy, desired_angle, theta_e, vL, vR; + + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + + if (point.x >= 873 && point.y >= 217 && point.y <= 607) + if (robot->position.x >= 873) { + if (robot->position.y <= 217) { + point.x = robot->position.x - (robot->position.x - point.x) * (217 - robot->position.y) / (point.y - robot->position.y); + point.y = 217; + } + else if (robot->position.y >= 607) { + point.x = robot->position.x - (robot->position.x - point.x) * (607 - robot->position.y) / (point.y - robot->position.y); + point.y = 607; + } + } + else { + point.x = 873; + point.y = robot->position.y - (robot->position.y - point.y) * (873 - robot->position.x) / (point.x - robot->position.x); + } + + point.x = point.x < boundRect.left ? boundRect.left : point.x; + point.x = point.x > boundRect.right ? boundRect.right : point.x; + point.y = point.y < boundRect.top ? boundRect.top : point.y; + point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; + + dx = point.x - robot->position.x; + dy = point.y - robot->position.y; + + distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); + + if (dx == 0 && dy == 0) + desired_angle = 90; + else + desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); + + theta_e = desired_angle - robot->angle; + + while (theta_e > 180) + theta_e -= 360; + while (theta_e < -180) + theta_e += 360; + + if (theta_e < -90) { + theta_e += 180; + distance_e = -distance_e; + } + else if (theta_e > 90) { + theta_e -= 180; + distance_e = -distance_e; + } + + vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); + vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); + + Velocity(which, vL, vR); +} + +void CStrategySystem::Rush(int which, CPoint point) { + Robot2 *robot; + double distance_e; + int dx, dy, desired_angle, theta_e, vL, vR; + + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + + CPoint p3; + + // 计算射线的斜率和截距 + double k = (double)(point.y - robot->position.y) / (point.x - robot->position.x); + double b = robot->position.y - k * robot->position.x; + // 判断射线的方向 + bool right = point.x > robot->position.x; // 是否向右 + bool up = point.y < robot->position.y; // 是否向上 + // 根据方向和斜率判断相交边 + if (right && up) { // 右上方 + if (k > 0) { // 斜率大于 0 + // 右边或上边 + if (k * boundRect.right + b < boundRect.top) { + // 右边 + p3.x = boundRect.right; + p3.y = k * boundRect.right + b; + } + else { + // 上边 + p3.x = (boundRect.top - b) / k; + p3.y = boundRect.top; + } + } + else { // 斜率小于等于 0 + // 上边或右边 + if ((boundRect.top - b) / k > boundRect.right) { + // 上边 + p3.x = (boundRect.top - b) / k; + p3.y = boundRect.top; + } + else { + // 右边 + p3.x = boundRect.right; + p3.y = k * boundRect.right + b; + } + } + } + else if (right && !up) { // 右下方 + if (k > 0) { // 斜率大于 0 + // 下边或右边 + if ((boundRect.bottom - b) / k < boundRect.right) { + // 下边 + p3.x = (boundRect.bottom - b) / k; + p3.y = boundRect.bottom; + } + else { + // 右边 + p3.x = boundRect.right; + p3.y = k * boundRect.right + b; + } + } + else { // 斜率小于等于 0 + // 右边或下边 + if (k * boundRect.right + b > boundRect.bottom) { + // 右边 + p3.x = boundRect.right; + p3.y = k * boundRect.right + b; + } + else { + // 下边 + p3.x = (boundRect.bottom - b) / k; + p3.y = boundRect.bottom; + } + } + } + else if (!right && up) { // 左上方 + if (k > 0) { // 斜率大于 0 + // 上边或左边 + if ((boundRect.top - b) / k < boundRect.left) { + // 上边 + p3.x = (boundRect.top - b) / k; + p3.y = boundRect.top; + } + else { + // 左边 + p3.x = boundRect.left; + p3.y = k * boundRect.left + b; + } + } + else { // 斜率小于等于 0 + // 左边或上边 + if (k * boundRect.left + b < boundRect.top) { + // 左边 + p3.x = boundRect.left; + p3.y = k * boundRect.left + b; + } + else { + // 上边 + p3.x = (boundRect.top - b) / k; + p3.y = boundRect.top; + } + } + } + else { // 左下方 + if (k > 0) { // 斜率大于 0 + // 左边或下边 + if (k * boundRect.left + b > boundRect.bottom) { + // 左边 + p3.x = boundRect.left; + p3.y = k * boundRect.left + b; + } + else { + // 下边 + p3.x = (boundRect.bottom - b) / k; + p3.y = boundRect.bottom; + } + } + else { // 斜率小于等于 0 + // 下边或左边 + if ((boundRect.bottom - b) / k > boundRect.left) { + // 下边 + p3.x = (boundRect.bottom - b) / k; + p3.y = boundRect.bottom; + } + else { + // 左边 + p3.x = boundRect.left; + p3.y = k * boundRect.left + b; + } + } + } + + point = p3; + + point.x = point.x < boundRect.left ? boundRect.left : point.x; + point.x = point.x > boundRect.right ? boundRect.right : point.x; + point.y = point.y < boundRect.top ? boundRect.top : point.y; + point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; + + dx = point.x - robot->position.x; + dy = point.y - robot->position.y; + + distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); + + if (dx == 0 && dy == 0) + desired_angle = 90; + else + desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); + + theta_e = desired_angle - robot->angle; + + while (theta_e > 180) + theta_e -= 360; + while (theta_e < -180) + theta_e += 360; + + if (theta_e < -90) { + theta_e += 180; + distance_e = -distance_e; + } + else if (theta_e > 90) { + theta_e -= 180; + distance_e = -distance_e; + } + + vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); + vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); + + Velocity(which, vL, vR); +} + +// 判断状态,1 为罚球,0 为正常, 其他为争球 +int CStrategySystem::Status() { + if (ball.position.x <= 309 && ball.position.x >= 279) { + if (ball.position.y >= 394 && ball.position.y <= 424) + return 1; // 罚球 + if (ball.position.y <= 193 && ball.position.y >= 173) + return 2; // 左上争球点 + if (ball.position.y <= 648 && ball.position.y >= 628) + return 3; // 左下争球点 + } + if (ball.position.x <= 753 && ball.position.x >= 733) { + if (ball.position.y <= 193 && ball.position.y >= 173) + return 4; // 右上争球点 + if (ball.position.y <= 648 && ball.position.y >= 628) + return 5; // 右下争球点 + } + return 0; +} + +void CStrategySystem::Action() { + T++; + Goalie(); + switch (Status()) { + case 1: + flag = true; + Penalty(); + break; + // case 2: + // case 3: + // case 4: + // case 5: + // Freeball(); + // break; + default: + flag = true; + Possession(); + break; + } + if (start) + start = false; +} + +void CStrategySystem::Angle(int which, int desired_angle) { + Robot2 *robot; + int theta_e, vL, vR; + + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + + theta_e = desired_angle - robot->angle; + while (theta_e > 180) + theta_e -= 360; + while (theta_e < -180) + theta_e += 360; + if (theta_e < -90) + theta_e += 180; + else if (theta_e > 90) + theta_e -= 180; + vL = (int)(60.0 / 90.0 * theta_e); + vR = (int)(-60.0 / 90.0 * theta_e); + Velocity(which, vL, vR); +} + +void CStrategySystem::Velocity(int which, int vL, int vR) { + if (vL < -127) + vL = -127; + if (vL > 127) + vL = 127; + + if (vR < -127) + vR = -127; + if (vR > 127) + vR = 127; + + switch (which) { + case HOME1: + command[2] = vL; + command[3] = vR; + command[4] = C_GO; + break; + case HOME2: + command[5] = vL; + command[6] = vR; + command[7] = C_GO; + break; + case HOME3: + command[8] = vL; + command[9] = vR; + command[10] = C_GO; + break; + case HOME4: + command[11] = vL; + command[12] = vR; + command[13] = C_GO; + break; + case HOME5: + command[14] = vL; + command[15] = vR; + command[16] = C_GO; + break; + case HOME6: + command[17] = vL; + command[18] = vR; + command[19] = C_GO; + break; + case HOME7: + command[20] = vL; + command[21] = vR; + command[22] = C_GO; + break; + case HOME8: + command[23] = vL; + command[24] = vR; + command[25] = C_GO; + break; + case HOME9: + command[26] = vL; + command[27] = vR; + command[28] = C_GO; + break; + case HOME10: + command[29] = vL; + command[30] = vR; + command[31] = C_GO; + break; + case HGOALIE: + command[32] = vL; + command[33] = vR; + command[34] = C_GO; + break; + } +} + +void CStrategySystem::Position(int which, CPoint point) { + Robot2 *robot; + double distance_e; + int dx, dy, desired_angle, theta_e, vL, vR; + + switch (which) { + case HOME1: + robot = &home1; + break; + case HOME2: + robot = &home2; + break; + case HOME3: + robot = &home3; + break; + case HOME4: + robot = &home4; + break; + case HOME5: + robot = &home5; + break; + case HOME6: + robot = &home6; + break; + case HOME7: + robot = &home7; + break; + case HOME8: + robot = &home8; + break; + case HOME9: + robot = &home9; + break; + case HOME10: + robot = &home10; + break; + case HGOALIE: + robot = &hgoalie; + break; + } + + point.x = point.x < boundRect.left ? boundRect.left : point.x; + point.x = point.x > boundRect.right ? boundRect.right : point.x; + point.y = point.y < boundRect.top ? boundRect.top : point.y; + point.y = point.y > boundRect.bottom ? boundRect.bottom : point.y; + + dx = point.x - robot->position.x; + dy = point.y - robot->position.y; + + distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy); + + if (dx == 0 && dy == 0) + desired_angle = 90; + else + desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx))); + + theta_e = desired_angle - robot->angle; + + while (theta_e > 180) + theta_e -= 360; + while (theta_e < -180) + theta_e += 360; + + if (theta_e < -90) { + theta_e += 180; + distance_e = -distance_e; + } + else if (theta_e > 90) { + theta_e -= 180; + distance_e = -distance_e; + } + + vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e)); + vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e)); + + Velocity(which, vL, vR); +} + +void CStrategySystem::Stop(int which) { + int vL, vR; + vL = vR = 0; + Velocity(which, vL, vR); +} + +void CStrategySystem::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) { + if (m_nGameArea == GAME_RIGHT) { + ball.position = bal.position; + ball.angle = bal.angle; + + home1.position = ho1.position; + home1.angle = ho1.angle; + + home2.position = ho2.position; + home2.angle = ho2.angle; + + home3.position = ho3.position; + home3.angle = ho3.angle; + + home4.position = ho4.position; + home4.angle = ho4.angle; + + home5.position = ho5.position; + home5.angle = ho5.angle; + + home6.position = ho6.position; + home6.angle = ho6.angle; + + home7.position = ho7.position; + home7.angle = ho7.angle; + + home8.position = ho8.position; + home8.angle = ho8.angle; + + home9.position = ho9.position; + home9.angle = ho9.angle; + + home10.position = ho10.position; + home10.angle = ho10.angle; + + hgoalie.position = hgo.position; + hgoalie.angle = hgo.angle; + + opponent.position1 = opp.position1; + opponent.position2 = opp.position2; + opponent.position3 = opp.position3; + opponent.position4 = opp.position4; + opponent.position5 = opp.position5; + opponent.position6 = opp.position6; + opponent.position7 = opp.position7; + opponent.position8 = opp.position8; + opponent.position9 = opp.position9; + opponent.position10 = opp.position10; + opponent.position11 = opp.position11; + } + else { + ball.position.x = 1030 - bal.position.x; + ball.position.y = 818 - bal.position.y; + if (ball.angle > 0) + ball.angle = bal.angle - 180; + else + ball.angle = 180 + bal.angle; + + home1.position.x = 1030 - ho1.position.x; + home1.position.y = 818 - ho1.position.y; + if (home1.angle > 0) + home1.angle = ho1.angle - 180; + else + home1.angle = 180 + ho1.angle; + home2.position.x = 1030 - ho2.position.x; + home2.position.y = 818 - ho2.position.y; + if (home2.angle > 0) + home2.angle = ho2.angle - 180; + else + home2.angle = 180 + ho2.angle; + home3.position.x = 1030 - ho3.position.x; + home3.position.y = 818 - ho3.position.y; + if (home3.angle > 0) + home3.angle = ho3.angle - 180; + else + home3.angle = 180 + ho3.angle; + home4.position.x = 1030 - ho4.position.x; + home4.position.y = 818 - ho4.position.y; + if (home4.angle > 0) + home4.angle = ho4.angle - 180; + else + home4.angle = 180 + ho4.angle; + home5.position.x = 1030 - ho5.position.x; + home5.position.y = 818 - ho5.position.y; + if (home5.angle > 0) + home5.angle = ho5.angle - 180; + else + home5.angle = 180 + ho5.angle; + //*/ + home6.position.x = 1030 - ho6.position.x; + home6.position.y = 818 - ho6.position.y; + ///* + if (home6.angle > 0) + home6.angle = ho6.angle - 180; + else + home6.angle = 180 + ho6.angle; + //*/ + home7.position.x = 1030 - ho7.position.x; + home7.position.y = 818 - ho7.position.y; + ///* + if (home7.angle > 0) + home7.angle = ho7.angle - 180; + else + home7.angle = 180 + ho7.angle; + //*/ + home8.position.x = 1030 - ho8.position.x; + home8.position.y = 818 - ho8.position.y; + ///* + if (home8.angle > 0) + home8.angle = ho8.angle - 180; + else + home8.angle = 180 + ho8.angle; + //*/ + home9.position.x = 1030 - ho9.position.x; + home9.position.y = 818 - ho9.position.y; + ///* + if (home9.angle > 0) + home9.angle = ho9.angle - 180; + else + home9.angle = 180 + ho9.angle; + //*/ + home10.position.x = 1030 - ho10.position.x; + home10.position.y = 818 - ho10.position.y; + ///* + if (home10.angle > 0) + home10.angle = ho10.angle - 180; + else + home10.angle = 180 + ho10.angle; + //*/ + hgoalie.position.x = 1030 - hgo.position.x; + hgoalie.position.y = 818 - hgo.position.y; + ///* + if (hgoalie.angle > 0) + hgoalie.angle = hgo.angle - 180; + else + hgoalie.angle = 180 + hgo.angle; + //*/ + opponent.position1.x = 1030 - opp.position1.x; + opponent.position2.x = 1030 - opp.position2.x; + opponent.position3.x = 1030 - opp.position3.x; + opponent.position4.x = 1030 - opp.position4.x; + opponent.position5.x = 1030 - opp.position5.x; + opponent.position6.x = 1030 - opp.position6.x; + opponent.position7.x = 1030 - opp.position7.x; + opponent.position8.x = 1030 - opp.position8.x; + opponent.position9.x = 1030 - opp.position9.x; + opponent.position10.x = 1030 - opp.position10.x; + opponent.position11.x = 1030 - opp.position11.x; + + opponent.position1.y = 818 - opp.position1.y; + opponent.position2.y = 818 - opp.position2.y; + opponent.position3.y = 818 - opp.position3.y; + opponent.position4.y = 818 - opp.position4.y; + opponent.position5.y = 818 - opp.position5.y; + opponent.position6.y = 818 - opp.position6.y; + opponent.position7.y = 818 - opp.position7.y; + opponent.position8.y = 818 - opp.position8.y; + opponent.position9.y = 818 - opp.position9.y; + opponent.position10.y = 818 - opp.position10.y; + opponent.position11.y = 818 - opp.position11.y; + } +} + +CStrategySystem::CStrategySystem(int id) { + T = 0; + + start = true; + + pos = new CPoint[10]; + rp = new RelPos[10]; + + for (int i = 0; i < 10; i++) { + rp[i].ang = 0; + rp[i].dis = 0; + rp[i].id = i + 1; + } + + flag = true; + + m_OurTeam = id; + boundRect.SetRect(65, 95, 965, 723); + if (id) + m_nGameArea = GAME_LEFT; + else + m_nGameArea = GAME_RIGHT; + for (int i = 0; i < 35; i++) + command[i] = 0; + C_Home1.Data.Lv = 0; + C_Home1.Data.Rv = 0; + C_Home1.Data.Command = C_STOP; + C_Home2.Data.Lv = 0; + C_Home2.Data.Rv = 0; + C_Home2.Data.Command = C_STOP; + C_Home3.Data.Lv = 0; + C_Home3.Data.Rv = 0; + C_Home3.Data.Command = C_STOP; + C_Home4.Data.Lv = 0; + C_Home4.Data.Rv = 0; + C_Home4.Data.Command = C_STOP; + C_Home5.Data.Lv = 0; + C_Home5.Data.Rv = 0; + C_Home5.Data.Command = C_STOP; + C_Home6.Data.Lv = 0; + C_Home6.Data.Rv = 0; + C_Home6.Data.Command = C_STOP; + C_Home7.Data.Lv = 0; + C_Home7.Data.Rv = 0; + C_Home7.Data.Command = C_STOP; + C_Home8.Data.Lv = 0; + C_Home8.Data.Rv = 0; + C_Home8.Data.Command = C_STOP; + C_Home9.Data.Lv = 0; + C_Home9.Data.Rv = 0; + C_Home9.Data.Command = C_STOP; + C_Home10.Data.Lv = 0; + C_Home10.Data.Rv = 0; + C_Home10.Data.Command = C_STOP; + C_Home11.Data.Lv = 0; + C_Home11.Data.Rv = 0; + C_Home11.Data.Command = C_STOP; + + m_nStrategy = id; // left = 0, right = 1 + nKick = 0; + nKick2 = 0; + nShoot = 0; + nSweep = 0; +} + +// CStrategySystem::~CStrategySystem() { +// } diff --git a/TParseString.cpp b/src/TParseString.cpp similarity index 94% rename from TParseString.cpp rename to src/TParseString.cpp index 648cd0c..d69af2c 100644 --- a/TParseString.cpp +++ b/src/TParseString.cpp @@ -1,242 +1,242 @@ -// TParseString.cpp: implementation of the TParseString class. -// -////////////////////////////////////////////////////////////////////// - -#include // MFC core and standard components -#include // MFC extensions -#include "stdafx.h" -#include "TParseString.h" - -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#define new DEBUG_NEW -#endif - -BOOL TParseString::ParseBracket(TParseString &retString) { - int iNoOfOpenBrackets = 1; - int iRightPosition = m_iPosition + 1; - int iLen = GetLength(); - m_bErrorOccured = FALSE; - // iposition must index an opening bracket - if ((m_iPosition >= iLen) || GetAt(m_iPosition) != '(') - return FALSE; - - while (iNoOfOpenBrackets > 0) { - // reached the end of the string ? error - if (iRightPosition >= iLen) - return FALSE; - - // look at the next character - switch (GetAt(iRightPosition)) { - case '(': - iNoOfOpenBrackets++; - break; - - case ')': - iNoOfOpenBrackets--; - break; - } - iRightPosition++; - } - retString.CString::operator=(Mid(m_iPosition + 1, iRightPosition - m_iPosition - 2)); - m_iPosition = iRightPosition + 1; - return TRUE; -} - -BOOL TParseString::ParseString(CString &str) { - int iRightPos; - BOOL bReady = FALSE; - int len = GetLength(); - char tmp; - - m_bErrorOccured = FALSE; - OverreadLeadingSpaces(); - iRightPos = m_iPosition + 1; - - // check, if there is a string - if (m_iPosition - 1 >= len) { - // the expected string is not there - m_iPosition++; - return FALSE; - } - - // search for a ' ' or ')' - bReady = FALSE; - while (!bReady && (iRightPos < len)) { - tmp = GetAt(iRightPos); - switch (tmp) { - case ' ': - case ')': - case '\r': - case '\n': - bReady = TRUE; - break; - - default: - iRightPos++; - } - } - - // get the string - str = Mid(m_iPosition, iRightPos - m_iPosition); - m_iPosition = iRightPos + 1; - - return TRUE; -} - -int TParseString::ParseInteger() { - int iValue = 0; - BOOL bSign = FALSE; - BOOL bReady = FALSE; - char cChar; - int len = GetLength(); - - m_bErrorOccured = TRUE; - OverreadLeadingSpaces(); - // read in the number - while (!bReady && (m_iPosition < len)) { - cChar = GetAt(m_iPosition); - switch (cChar) { - case '-': - // only one - sign expected - bSign = TRUE; - m_iPosition++; - break; - - case '+': - m_iPosition++; - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - iValue = 10 * iValue + cChar - '0'; - m_bErrorOccured = FALSE; - m_iPosition++; - break; - - case ')': - case ' ': - m_iPosition++; - // no break here - - default: - bReady = TRUE; - } - } - - // convert the number if neccessary - if (bSign) - iValue = -iValue; - - return iValue; -} - -double TParseString::ParseDouble() { - double dValue = 0.0; - double dNumber; - BOOL bSign = FALSE; - BOOL bReady = FALSE; - BOOL bDot = FALSE; - double dDivisor = 1.0; - char cChar; - int len = GetLength(); - - m_bErrorOccured = TRUE; - // read in the number - while (!bReady && (m_iPosition < len)) { - cChar = GetAt(m_iPosition); - switch (cChar) { - case '-': - // only one - sign expected - bSign = TRUE; - m_iPosition++; - break; - - case '+': - m_iPosition++; - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - dValue = 10.0 * dValue + (double)(cChar - '0'); - dDivisor *= 10.0; - m_bErrorOccured = FALSE; - m_iPosition++; - break; - - case '.': - case ',': - dDivisor = 1.0; - bDot = TRUE; - m_iPosition++; - break; - - case ')': - case ' ': - m_iPosition++; - // no break here - - default: - bReady = TRUE; - } - } - - // convert the number if neccessary - if (bDot) - dNumber = dValue / dDivisor; - else - dNumber = dValue; - - if (bSign) - dNumber = -dNumber; - - return dNumber; -} - -void TParseString::OverreadLeadingSpaces() { - char tmp; - - // overread inital spaces, returns and new lines - while (m_iPosition < GetLength()) { - tmp = GetAt(m_iPosition); - switch (tmp) { - case ' ': - case '\r': - case '\n': - m_iPosition++; - break; - - default: - return; - } - } -} - -void TParseString::SetPosition(int pos) { - if (pos >= GetLength()) { - m_iPosition = GetLength() - 1; - if (m_iPosition < 0) - m_iPosition = 0; - } - else if (pos < 0) - m_iPosition = 0; - else - m_iPosition = pos; -} +// TParseString.cpp: implementation of the TParseString class. +// +////////////////////////////////////////////////////////////////////// + +#include // MFC core and standard components +#include // MFC extensions +#include "stdafx.h" +#include "TParseString.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#define new DEBUG_NEW +#endif + +BOOL TParseString::ParseBracket(TParseString &retString) { + int iNoOfOpenBrackets = 1; + int iRightPosition = m_iPosition + 1; + int iLen = GetLength(); + m_bErrorOccured = FALSE; + // iposition must index an opening bracket + if ((m_iPosition >= iLen) || GetAt(m_iPosition) != '(') + return FALSE; + + while (iNoOfOpenBrackets > 0) { + // reached the end of the string ? error + if (iRightPosition >= iLen) + return FALSE; + + // look at the next character + switch (GetAt(iRightPosition)) { + case '(': + iNoOfOpenBrackets++; + break; + + case ')': + iNoOfOpenBrackets--; + break; + } + iRightPosition++; + } + retString.CString::operator=(Mid(m_iPosition + 1, iRightPosition - m_iPosition - 2)); + m_iPosition = iRightPosition + 1; + return TRUE; +} + +BOOL TParseString::ParseString(CString &str) { + int iRightPos; + BOOL bReady = FALSE; + int len = GetLength(); + char tmp; + + m_bErrorOccured = FALSE; + OverreadLeadingSpaces(); + iRightPos = m_iPosition + 1; + + // check, if there is a string + if (m_iPosition - 1 >= len) { + // the expected string is not there + m_iPosition++; + return FALSE; + } + + // search for a ' ' or ')' + bReady = FALSE; + while (!bReady && (iRightPos < len)) { + tmp = GetAt(iRightPos); + switch (tmp) { + case ' ': + case ')': + case '\r': + case '\n': + bReady = TRUE; + break; + + default: + iRightPos++; + } + } + + // get the string + str = Mid(m_iPosition, iRightPos - m_iPosition); + m_iPosition = iRightPos + 1; + + return TRUE; +} + +int TParseString::ParseInteger() { + int iValue = 0; + BOOL bSign = FALSE; + BOOL bReady = FALSE; + char cChar; + int len = GetLength(); + + m_bErrorOccured = TRUE; + OverreadLeadingSpaces(); + // read in the number + while (!bReady && (m_iPosition < len)) { + cChar = GetAt(m_iPosition); + switch (cChar) { + case '-': + // only one - sign expected + bSign = TRUE; + m_iPosition++; + break; + + case '+': + m_iPosition++; + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + iValue = 10 * iValue + cChar - '0'; + m_bErrorOccured = FALSE; + m_iPosition++; + break; + + case ')': + case ' ': + m_iPosition++; + // no break here + + default: + bReady = TRUE; + } + } + + // convert the number if neccessary + if (bSign) + iValue = -iValue; + + return iValue; +} + +double TParseString::ParseDouble() { + double dValue = 0.0; + double dNumber; + BOOL bSign = FALSE; + BOOL bReady = FALSE; + BOOL bDot = FALSE; + double dDivisor = 1.0; + char cChar; + int len = GetLength(); + + m_bErrorOccured = TRUE; + // read in the number + while (!bReady && (m_iPosition < len)) { + cChar = GetAt(m_iPosition); + switch (cChar) { + case '-': + // only one - sign expected + bSign = TRUE; + m_iPosition++; + break; + + case '+': + m_iPosition++; + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + dValue = 10.0 * dValue + (double)(cChar - '0'); + dDivisor *= 10.0; + m_bErrorOccured = FALSE; + m_iPosition++; + break; + + case '.': + case ',': + dDivisor = 1.0; + bDot = TRUE; + m_iPosition++; + break; + + case ')': + case ' ': + m_iPosition++; + // no break here + + default: + bReady = TRUE; + } + } + + // convert the number if neccessary + if (bDot) + dNumber = dValue / dDivisor; + else + dNumber = dValue; + + if (bSign) + dNumber = -dNumber; + + return dNumber; +} + +void TParseString::OverreadLeadingSpaces() { + char tmp; + + // overread inital spaces, returns and new lines + while (m_iPosition < GetLength()) { + tmp = GetAt(m_iPosition); + switch (tmp) { + case ' ': + case '\r': + case '\n': + m_iPosition++; + break; + + default: + return; + } + } +} + +void TParseString::SetPosition(int pos) { + if (pos >= GetLength()) { + m_iPosition = GetLength() - 1; + if (m_iPosition < 0) + m_iPosition = 0; + } + else if (pos < 0) + m_iPosition = 0; + else + m_iPosition = pos; +}