Page 1 of 1

learn hex: script to aid learning A-F values and partitions

Posted: 06 Jul 2018, 02:34
by jeeswg
Computers are there to do the repetitive work for you, however, I believe that while programming, it would be advantageous to have this knowledge committed to memory, especially when dealing with window styles/ex. styles and other combinations of flags.

Code: Select all

hex	dec	partition
A	10	8+2
B	11	8+2+1
C	12	8+4
D	13	8+4+1
E	14	8+4+2
F	15	8+4+2+1
As of yet I still haven't found it easy to retain this to memory by sheer use, so I considered taking a more active approach.

Code: Select all

q:: ;learn hex: script to aid learning A-F values and partitions
;output a random hex letter to test your:
;hex to dec skills, and hex partition skills
;note: all partitions contain 2 except those for C and D
oArray := StrSplit("8+2,8+2+1,8+4,8+4+1,8+4+2,8+4+2+1", ",")
Loop
{
	;vNum := Random(1, 6) ;AHK v2
	Random, vNum, 1, 6 ;AHK v1
	if (vNum = vNumLast)
		continue
	vLetter := Chr(64+vNum)
	MsgBox, % vLetter "`r`n`r`n "
	MsgBox, % vLetter "`r`n" (9+vNum) "`r`n" oArray[vNum]
	vNumLast := vNum
}
return