Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/27/2021 in all areas

  1. I have been wanting to program a game and now I have done it. It's a fairly small script with no fluff like About boxes or instructions. Now I need to make a chess game (kidding). Hope everyone likes it. Cheers! 🥃 Update: Thanks to Dan_555's suggestion, I have changed the randomize option to move tiles around instead of using _arrayshuffle. Also, I added in a Settings option so you tell it how many moves to shuffle it. Download v.1.1 for these features. The Slide Puzzle v.1.0.zipThe Slide Puzzle v.1.1.zip
    2 points
  2. As a general rule of thumb, a 2D shuffle puzzle of dimension N (that is of size NxN) is solvable iff, when reading values from, say, top left to bottom right, row by row) the number of permutations of cells (cell with value X appears before cell with value Y AND X > Y) is even. This works whatever the empty cell is. @Dan_555 example gives a odd number of permutations, hence it isn't solvable. For those who care, here's a wiki page explaining the fact: https://fr.wikipedia.org/wiki/Signature_d'une_permutation Sorry, as is often the case in wikipedia maths pages, there is no direct english translation. Try Google translate if that works, but many French terms used in combinatorics have only vague equivalent in english (and often ambiguous) due to a radically different approach to the domain.
    2 points
  3. Hi, the game is nice but the array-shuffle can create unsolvable puzzles. You have to swap the pieces one by one, in the code, just like you would do it manually. (by moving the empty square up/down/left/right randomly, swapping the numbers) You can test a puzzle solver here: https://gamingph.com/blackdesertmobile/puzzle/puzzle.html Drag the pieces from the top square to the bottom square and in this order: 1 2 3 4 5 8 7 6 And the puzzle (afaik) can not be solved.
    1 point
  4. I like. You can also add control from the keyboard.
    1 point
  5. Hi rcmaehl Here is the display when I launch your script (the light grey background comes from my Windows theme, on your computer it's probably a white background) : So you're asking how to get rid of the red background displayed behind the icon ? I was lucky to find this thread where Yashied attached a function named _SetBkIcon() Unfortunately his function can't be downloaded from there as it's not hosted on AutoIt. Trying some google search, I found Yashied's function inside a script from funkey. Here is the result, based on the way you scripted it (the icon over the label) : #Include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> Example() Func Example() $hGUI = GUICreate("Icons", 200, 250) $BKC = _WinAPI_GetSysColor($COLOR_WINDOW) ; window background (help file) ; ConsoleWrite("0x" & Hex($BKC, 6) & @crlf) ; 0xE3DFE0 (light grey, my windows theme) GUISetBkColor(0xFF0000) ; red (Gui) GUICtrlSetDefColor(0x0000FF) ; blue (controls) GUICtrlSetDefBKColor(0x00FF00) ; green (controls) GUICtrlCreateLabel("test label", 0, 0, 100, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER)) ; blue on green GUICtrlCreateLabel("", 0, 20, 100, 230) GUICtrlSetBkColor(-1, $BKC) ; light grey (background) $Icon1 = GUICtrlCreateIcon('', -1, 30, 40) ; left, top $Icon2 = GUICtrlCreateIcon('', -1, 20, 100) $Icon3 = GUICtrlCreateIcon('', -1, 25, 180) _GDIPlus_Startup() _SetBkIcon($Icon1, $BKC, @SystemDir & '\shell32.dll', 10, 32, 32) ; icon #10, width, height _SetBkIcon($Icon2, $BKC, @SystemDir & '\shell32.dll', 130, 48, 48) _SetBkIcon($Icon3, $BKC, @SystemDir & '\shell32.dll', 131, 48, 48) _GDIPlus_Shutdown() GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example ;============================================================================ Func _SetBkIcon($ControlID, $iBackground, $sIcon, $iIndex, $iWidth, $iHeight) Local Static $STM_SETIMAGE = 0x0172 Local $tIcon, $tID, $hDC, $hBackDC, $hBackSv, $hBitmap, $hImage, $hIcon, $hBkIcon $tIcon = DllStructCreate('hwnd') $tID = DllStructCreate('hwnd') $hIcon = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0) If (@error) Or ($hIcon[0] = 0) Then Return SetError(1, 0, 0) EndIf $hIcon = DllStructGetData($tIcon, 1) $tIcon = 0 $tID = 0 $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight) $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap) _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hBkIcon = DllCall($__g_hGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'hWnd', $hImage, 'int*', 0) $hBkIcon = $hBkIcon[2] _GDIPlus_ImageDispose($hImage) GUICtrlSendMsg($ControlID, $STM_SETIMAGE, $IMAGE_ICON, _WinAPI_CopyIcon($hBkIcon)) _WinAPI_RedrawWindow(GUICtrlGetHandle($ControlID)) _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_DeleteDC($hBackDC) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteObject($hBkIcon) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hIcon) Return SetError(0, 0, 1) EndFunc ;==>_SetBkIcon Hope it helps and good luck
    1 point
  6. Thanks for the suggestions, and if I was just doing it for me, they or some of the others suggested would probably do the job. They won't help my kids etc. Not sure using a substitute drive would help. It might as far as source files go, but the destination folder path needs to be similar to the original source one, as that is how I structurally store my stuff. In any case, I'd rather cure than bandaid the situation. I'd use Dcoder's suggestion of the browser addon as a preventative measure, if it wasn't such a pain, so that everything was saved decently in the first place ... no cure or bandaid needed in that scenario.
    1 point
  7. sorry for the late reply. two things i found useful in the past dealing with this kind of issue were: the quick'n'dirty way: use the SUBST command to shorten the base path to a single drive letter. before placing anything in the target folder, do something like this: SUBST X: "C:\Users\TheSaint\Downloads\2021\02\10\GoG\Irony Curtain - From Matryoshka with Love - Revolutionary Edition\_Html" later in your code, refer to X: instead of that long path. although this works, this method has some obvious caveats, and i never use it anymore now that i have a more professional method: use unicode functions to handle your copy/move/etc file operations. i made a UDF to streamline the process, so now i have absolutely no worries about long path issues. you can just use the UDF as is, or look inside to see how it's done and implement only the bits and pieces you find useful.
    1 point
×
×
  • Create New...