Advertisement
pastamaker

guess what you've written

May 27th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. #Include,<gdip>
  6. SetBatchLines, -1
  7.  
  8.  
  9. global dir1
  10. global dir2
  11.  
  12.  
  13. global y10:=100
  14. global step0:=40
  15.  
  16. global abc
  17. global cba
  18.  abc:= ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
  19.  
  20.  cba:= ["21111","33210","14111","31111","41111","12200","12100","11211","41211","42200","31211","11111","43211","33211","33110","13011","31221","41221","12110","34221","33201","13221","11021","13201","32210","11121"]
  21.  
  22.  
  23.  
  24.  
  25.  
  26. pToken := Gdip_Startup()
  27. global game:={h:500,w:100,x:400,y:100}
  28.  
  29. gui,1:  -caption +lastfound -dpiscale +E0x80000    +AlwaysOnTop
  30. GUI,1:Show,% "x" game.x " y" game.y " w" game.w " h" game.h
  31.  
  32. hwndl:=WinExist()
  33.  
  34. hbm := CreateDIBSection(game.w, game.h)
  35.  
  36. hdc:=CreateCompatibleDC()
  37.  
  38. obm:=SelectObject(hdc,hbm )
  39.  
  40. G := Gdip_GraphicsFromHDC(hdc)
  41.  
  42. Gdip_SetSmoothingMode(G, 4)
  43.  
  44.  
  45. pbrush1:=Gdip_BrushCreateSolid("0xffaf0c0b")
  46. pbrush2:=Gdip_BrushCreateSolid("0xff00ff00")
  47. pbrush3:=Gdip_BrushCreateSolid("0xff0000ff")
  48. pbrush4:=Gdip_BrushCreateSolid("0x00ffffff")
  49. pbrush5:=Gdip_BrushCreateSolid("0xffffffff")
  50. pbrush6:=Gdip_BrushCreateSolid("0xff0c00b0")
  51. pbrush7:=Gdip_BrushCreateSolid("0xff000000")
  52.  
  53. pPen1 := Gdip_CreatePenFromBrush(pBrush1, 5)
  54. pPen2 := Gdip_CreatePenFromBrush(pBrush7, 1)
  55. pPen3 := Gdip_CreatePenFromBrush(pBrush7, 3)
  56. Gdip_FillRectangle(g, pBrush5, 0, 0, game.w, game.h)
  57.  
  58. gosub lay
  59.  
  60. UpdateLayeredWindow(hwndl, hdc, game.x, game.y, game.w, game.h)
  61. global mass_x:=[]
  62. global mass_y:=[]
  63.  
  64.  
  65.  
  66.  
  67. loop {
  68.     ;~ ToolTip,% "x1 : " x1 "  " x2 " : x2 `n" "y1 : " y1 "  " y2 " : y2 `n"pos(y2)
  69. ToolTip,% pos(y2)
  70.  
  71.     MouseGetPos,x2,y2
  72. key:=GetKeyState("lbutton")
  73. if(key==1 and ( x1<>x2 or y1<>y2 )){
  74. x1:=x2
  75. y1:=y2
  76.  
  77. mass_x.Insert(x1)
  78. mass_y.Insert(y1)
  79. }
  80.  
  81. gosub update
  82. }
  83.  
  84. a::
  85. mass_x:=[]
  86. mass_y:=[]
  87. return
  88.  
  89.  
  90.  
  91. update:
  92.  
  93.  
  94.  
  95. Gdip_FillRectangle(g, pBrush5, 0, 0, game.w, game.h)
  96. gosub lay
  97. for i,value in mass_x {
  98.    
  99. Gdip_FillEllipse(g, pBrush7, value, mass_y[i], 2, 2)
  100.  
  101. }
  102. UpdateLayeredWindow(hwndl, hdc)
  103. gosub dir1
  104. gosub dir2
  105. return
  106.  
  107.  
  108.  
  109.  
  110. lay:
  111. x10:=10
  112. x20:=350
  113. y10:=100
  114. ;~ step0:=40
  115. loop 4 {
  116.    
  117. Gdip_DrawLine(g, pPen2 , x10, y10, x20, y10)
  118.  
  119.  
  120. y10+=step0
  121. }
  122. loop 2 {
  123.    
  124. Gdip_DrawLine(g, pPen1 , x10, y10, x20, y10)
  125.  
  126.  
  127. y10+=step0
  128. }
  129. return
  130.  
  131.  
  132.  
  133.  
  134. ;~ loop {
  135.     ;~ key:=GetKeyState("lbutton")
  136. ;~ if(key==0)
  137.     ;~ continue
  138. ;~ ToolTip,1
  139. ;~ MouseGetPos,x1,y1
  140.    
  141.     ;~ loop {
  142.         ;~ key:=GetKeyState("lbutton")
  143. ;~ if(key==0){
  144.    
  145.     ;~ ToolTip,0
  146.     ;~ Sleep 150
  147.     ;~ MouseGetPos,x2,y2
  148. ;~ Gdip_DrawLine(g, pPen1 , x1, y1, x2, y2)
  149. ;~ UpdateLayeredWindow(hwndl, hdc)
  150. ;~ ToolTip
  151. ;~ break
  152. ;~ }
  153. ;~ }
  154. ;~ }
  155. GuiClose:
  156. GuiEscape:
  157. *x::
  158. Gdip_Shutdown(pToken)
  159. ExitApp
  160.  
  161.  
  162. dir1:
  163. dir1_x:=sg(mass_x[8]-mass_x[1])
  164. dir1_y:=sg(mass_y[8]-mass_y[1])
  165. (dir1_x = 1 and dir1_y = -1)?(dir1:=1):(dir1_x = -1 and dir1_y = -1)?(dir1:=2):(dir1_x = -1 and dir1_y = 1)?(dir1:=3):(dir1_x = 1 and dir1_y = 1)?(dir1:=4)
  166. ;~ MsgBox,% dir1
  167. return
  168. dir2:
  169. max:=mass_x.MaxIndex()
  170. dir1_x:=sg(mass_x[max]-mass_x[max-3])
  171. dir1_y:=sg(mass_y[max]-mass_y[max-3])
  172. (dir1_x = 1 and dir1_y = -1)?(dir2:=1):(dir1_x = -1 and dir1_y = -1)?(dir2:=2):(dir1_x = -1 and dir1_y = 1)?(dir2:=3):(dir1_x = 1 and dir1_y = 1)?(dir2:=4)
  173. ;~ MsgBox,% dir2
  174. return
  175.  
  176.  
  177. sg(x){
  178.     if(x=0)
  179. return 0
  180. return abs(x)/x
  181. }
  182.  
  183. pos(y){
  184.    
  185.  y10:=100
  186. val:=abs(4*step0+y10-y)//step0
  187. return val
  188.    
  189. }
  190. f::
  191. find_out()
  192. return
  193. find_out(){
  194.     comp1:=dir1
  195.     comp2:=dir2
  196.     comp3:=pos(mass_y[1])
  197.     comp4:=pos(mass_y[mass_y.MaxIndex()])
  198.     comp5:=0
  199.     (mass_x[mass_x.MaxIndex()]-mass_x[1] > 0 )?(comp5:=1)
  200.     comp=%comp1%%comp2%%comp3%%comp4%%comp5%
  201. for i,value in  cba {
  202.     if(value = comp ){
  203.         MsgBox,% abc[i]
  204.         return abc[i]
  205.     }
  206. }
  207. MsgBox,% comp
  208. SoundBeep,,250
  209. }
  210.  
  211.  
  212. 1::
  213. gosub dir1
  214. return
  215.  
  216. 2::
  217. gosub dir2
  218. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement