Jump to content
Sign in to follow this  
Bionic

Ai learning

Recommended Posts

Ai learning

why does some one make it where the bot can learn the game and it would nee less updates now i just was looking into ai learing and it would take a littel time but think it would be well worth it 

Share this post


Link to post

I applied artificial intelligence to the chat to read the messages of the clan, start reading first the most used languages in the clan and save them in an array.

Func ReadChatIA(ByRef $sOCRString, $sCondition = -1, $bFast = True)
	Local $bResult = True
	Local $asFCKeyword = ""

		$bResult = False
		Local $aLastResult[1][2]
		Local $sDirectory = @ScriptDir & "\COCBot\Team__AiO__MOD++\Images\ChatActions\Chat"
		Local $returnProps = "objectpoints"
		Local $aCoor
		Local $aPropsValues
		Local $aCoorXY
		Local $result

		Local $iMax = 0
		Local $jMax = 0
		Local $i, $j, $k
				
		ChatScroll()
		
		ForceCaptureRegion()
		_CaptureRegion2(260,85,272,624)
		$g_hHBitmap2 = GetHHBitmapArea($g_hHBitmap2, 0, 0, 10, 539)
		$result = findMultiple($sDirectory, "FV", "FV", 0, 0, 0, $returnProps, False)

		Local $iCount = 0
			If Not IsArray($result) Then Return False
			; [Removed] pay XML func is based on it !
			$iMax = UBound($result) - 1
			For $i = 0 To $iMax
				$aPropsValues = $result[$i] ; should be return objectname,objectpoints,objectlevel
				If UBound($aPropsValues) = 1 then
					$aCoor = StringSplit($aPropsValues[0], "|", $STR_NOCOUNT) ; objectpoints, split by "|" to get multi coor x,y ; same image maybe can detect at different location.
					If IsArray($aCoor) Then
						For $j = 0 To UBound($aCoor) - 1
							$aCoorXY = StringSplit($aCoor[$j], ",", $STR_NOCOUNT)
							ReDim $aLastResult[$iCount + 1][2]
							$aLastResult[$iCount][0] = Int($aCoorXY[0])
							$aLastResult[$iCount][1] = Int($aCoorXY[1]) + 82
							$iCount += 1
						Next
					EndIf
				EndIf
			Next
			If $iCount < 1 Then Return False
			_ArraySort($aLastResult, 1, 0, 0, 1) ; rearrange order by coor Y
			;_ArrayDisplay($aLastResult)
			$iMax = UBound($aLastResult) - 1

			Local $aIAVarTmp = $g_aIAVar
			_ArraySort($aIAVarTmp, 0, 0, 0, 1)
			_CaptureRegion2(0,0,287,732)
			For $i = 0 To $iMax
					If MultiPSimple(32, $aLastResult[$i][1], 135, $aLastResult[$i][1] + 33, Hex(0x92ED4D, 6), 20) <> 0 Then
						SetDebugLog("Chat IA : Own talk jumped.", $COLOR_INFO)
						ContinueLoop
					EndIf
						$sOCRString = ""
						For $ii = 0 To UBound($aIAVarTmp) - 1
						If _Sleep($DELAYDONATECC2) Then ExitLoop
							Switch $ii
								Case 0
									$sOCRString = getChatStringMod(30, $aLastResult[$i][1] + 43, "coc-latinA")
									SetDebugLog("getChatStringMod Latin : " & $sOCRString)
											If StringStripWS($sOCRString, $STR_STRIPALL) <> "" Then
											$g_aIAVar[0] += 1
											ExitLoop 1
										EndIf
								Case 1
									$sOCRString = getChatStringMod(30, $aLastResult[$i][1] + 43, "coc-latin-cyr")
									SetDebugLog("getChatStringMod Cyc : " & $sOCRString)
											If StringStripWS($sOCRString, $STR_STRIPALL) <> "" Then
											$g_aIAVar[1] += 1
											ExitLoop 1
										EndIf
								Case 2
									$sOCRString = getChatStringChineseMod(30, $aLastResult[$i][1] + 43)
									SetDebugLog("getChatStringChineseMod : " & $sOCRString)
											If StringStripWS($sOCRString, $STR_STRIPALL) <> "" Then
											$g_aIAVar[2] += 1
											ExitLoop 1
										EndIf
								Case 3
									$sOCRString = getChatStringKoreanMod(30, $aLastResult[$i][1] + 43)
									SetDebugLog("getChatStringKoreanMod : " & $sOCRString)
											If StringStripWS($sOCRString, $STR_STRIPALL) <> "" Then
											$g_aIAVar[3] += 1
											ExitLoop 1
										EndIf
								Case 4
									$sOCRString = getChatStringPersianMod(30, $aLastResult[$i][1] + 43)
									SetDebugLog("getChatStringPersianMod : " & $sOCRString)
											If StringStripWS($sOCRString, $STR_STRIPALL) <> "" Then
											$g_aIAVar[4] += 1
											ExitLoop 1
										EndIf
							EndSwitch
						Next
				If StringStripWS($sOCRString, $STR_STRIPALL) = "" Then 
					SetDebugLog("Chat IA : Unable to read Chat!", $COLOR_ERROR)
				Else
 					;SetLog("Chat : " & $sOCRString, $COLOR_INFO)
					;If $sCondition = -1 Then
					;	$bResult &= " " & $sOCRString
					;Else
 						Local $asFCKeyword = StringSplit($sCondition, "|", BitOR($STR_ENTIRESPLIT, $STR_NOCOUNT))

						For $j = 0 To UBound($asFCKeyword) - 1
							If StringInStr($sOCRString, $asFCKeyword[$j], 2) Then
								Setlog("Chat IA : " & $asFCKeyword[$j], $COLOR_SUCCESS)
								$bResult = True
								If $bFast = True Then Return $bResult
							EndIf
						Next
					;EndIf
				EndIf
			Next
	Return $bResult ; IF THE STATE = -1 CHAT TEXT IS RETURNED IN TEXT, ANOTHER BOOLEAN OF RETURN
EndFunc   ;==>ReadChatIA

Artificial intelligence is applied in almost the entire bot, that's what it is about!!!.

Edited by Boldina

Share this post


Link to post

I think he was looking for something a little more complex, maybe a neural network analysising base layouts and selecting the best csv to use?

Share this post


Link to post

well like so like the bot would learn to place buildings and learn new updates and would help the dev out s they are not having to update it every time clash has a update but more of a thought then it need to be just think it would be crazy to see it make crazy custom army to find the best attack for what it trying to do from upgrading or pushing troopys  and would teach it self to become more advanced for the builder base or even main but main would be  really hard because it way bigger then builders  

Share this post


Link to post
3 hours ago, Boldina said:

Artificial intelligence is applied in almost the entire bot, that's what it is about!!!.

There is no artificial intelligence in the bot. The code gives people options that they can use to be unique and of course is coded to do these actions as human as possible, and yes humanizing use some work lol but the bot does not "learn" anything. So in short, the bot will not make decisions based on encounters it has faced. It will not learn from bases it has seen, it will not learn good profile configs based on th and layout, and it will not be able to figure out changes that SC has made to the game and adjust code to work with it. (That would be either impossible or a very taxing task to say the least.)

 

All that being said, I think something that would be very cool (not saying it would for sure even work) is if someone played with some machine learning tactics. Maybe something that analysed config files and scored them on efficiency for mining a certain resources or an actual chat bot embedded in the bot that has small conversations with clan mates. This is not something that would likely be worked on by the development team but for anyone with experience in machine learning it could be a really fun project :beer: :smile:

 

NOTE: You could also apply machine learning maybe to army selection for particular bases, but as you all know the armies are already cooked when you encounter the base through the bot so that wouldn't work.

Share this post


Link to post

 

hace 5 horas, Chilly-Chill dijo:

There is no artificial intelligence in the bot. The code gives people options that they can use to be unique and of course is coded to do these actions as human as possible, and yes humanizing use some work lol but the bot does not "learn" anything. So in short, the bot will not make decisions based on encounters it has faced. It will not learn from bases it has seen, it will not learn good profile configs based on th and layout, and it will not be able to figure out changes that SC has made to the game and adjust code to work with it. (That would be either impossible or a very taxing task to say the least.)

 

All that being said, I think something that would be very cool (not saying it would for sure even work) is if someone played with some machine learning tactics. Maybe something that analysed config files and scored them on efficiency for mining a certain resources or an actual chat bot embedded in the bot that has small conversations with clan mates. This is not something that would likely be worked on by the development team but for anyone with experience in machine learning it could be a really fun project :beer: :smile:

 

NOTE: You could also apply machine learning maybe to army selection for particular bases, but as you all know the armies are already cooked when you encounter the base through the bot so that wouldn't work.

Difficult is not true ?, Already the fact that recognizes images is a great.

Share this post


Link to post
On 1/22/2020 at 8:05 PM, Chilly-Chill said:

There is no artificial intelligence in the bot. The code gives people options that they can use to be unique and of course is coded to do these actions as human as possible, and yes humanizing use some work lol but the bot does not "learn" anything. So in short, the bot will not make decisions based on encounters it has faced. It will not learn from bases it has seen, it will not learn good profile configs based on th and layout, and it will not be able to figure out changes that SC has made to the game and adjust code to work with it. (That would be either impossible or a very taxing task to say the least.)

 

All that being said, I think something that would be very cool (not saying it would for sure even work) is if someone played with some machine learning tactics. Maybe something that analysed config files and scored them on efficiency for mining a certain resources or an actual chat bot embedded in the bot that has small conversations with clan mates. This is not something that would likely be worked on by the development team but for anyone with experience in machine learning it could be a really fun project :beer: :smile:

 

NOTE: You could also apply machine learning maybe to army selection for particular bases, but as you all know the armies are already cooked when you encounter the base through the bot so that wouldn't work.

thanks chill 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
×
×
  • Create New...