Author Topic: Count the dots  (Read 2991 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Count the dots
« on: January 26, 2021, 05:10:29 pm »
Here's a little program folks can have fun with.  Can you count the number of solid circles, and the number of non-solid circles?  Or can you even tell the difference?

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(400, 400, 32)
  2.  
  3. DATA 789CEDDD4B8E22391405D0DE0BD3DE10FBE2D34D4B8C611F3067CA1C58018CDDBA295142A8A02A89944DBA8EA5A72209FBD53DA3504418F8EBAFBFCA5F5F507FFFFD77F9E79F7FCA7FFFFD57FEFDF7DFA79539999B355FF17F7F6571B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707C76347FEBE2D0E0E0E8E77288EF6D97FE6582C16653A9D96C96452E6F3F98FEC799DF7722C73383838383838AE8ED96CF69177B55A95ED765BF6FB7D391C0E1F95D7792FC732277339383838383846A351592E9765B7DB95F3F95C1E8D1CCB9CCCCD9AD6B939383838385EAB9C8B8656F28CC7E3723A9D1EE6BF1F999B3559FB15193838383838EA3AEE9FB57CB6723D9473DAF178FC6DC375644DD6A6C7D01C1C1C1C1C1C751D79263FA4724F2DD745AF8EAC4D8FA1393838383838EA3A7EB567F859E599FE7ABD2E97CBE56547D6A6477A0DC9C2C1C1C1C1F17D1CD917B6D96C5E365C477AA4170707070747FF8EDCFBCAF54FF6870D1DE9915EE9C9C1C1C1C1D1BF23FF668FF1D0911EB73D393838383838383838383838EE1DBD5C477170707070D4AD1E9EE37070707070D4AF5EF69171707070707CBE7AF91C0B07070707475D472F9FA3E7E0E0E0E0A8EBE8E57BBC3838383838EA3A7AF91E610E0E0E0E8EEFE9C8B9A887DF31E1689F9D8383E3CF73E47E580FBFA3C8F13EC5D13E3B07472D479EC95FB3DF3F6BB9DDF3C5C1C1C1C1C1F1C8F16CCF3007070707070707070707070707C73B1547FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1D1C291BF6F8B838383E31D8AA37DF69F39168B45994EA765329994F97CFE237B5EE7BD1CCB1C0E0E0E0E0E8EAB63369B7DE45DAD5665BBDD96FD7E5F0E87C347E575DECBB1CCC95C0E0E0E0E0E8ED1685496CB65D9ED76E57C3E974723C7322773B3A6756E0E0E0E0E8ED72AE7A2A1953CE3F1B89C4EA787F9EF47E6664DD67E45060E0E0E0E8EBA8EFB672D9FAD5C0FE59C763C1E7FDB701D5993B5E931340707070707475D479EC90FA9DC53CB75D1AB236BD363680E0E0E0E0E8EBA8E5FED197E5679A6BF5EAFCBE57279D991B5E9915E43B270707070707C1F47F6856D369B970DD7911EE9C5C1C1C1C1D1BF23F7BE72FD93FD6143477AA4577A7270707070F4EFC8BFD9633C74A4C76D4F0E0E0E0E0E0E0E0E0E0E0E8E7B472FD7511C1C1C1C1C75AB87E7381C1C1C1C1CF5AB977D641C1C1C1C1C9FAF5E3EC7C2C1C1C1C151D7D1CBE7E83938383838EA3A7AF91E2F0E0E0E0E8EBA8E5EBE479883838383E37B3A722EEAE1774C38DA67E7E0E0F8F31CB91FD6C3EF2872BC4F71B4CFCEC151CB9167F2D7ECF7CF5A6EF77C7170707070703C723CDB33CCC1C1C1C1C1C1C1C1C1C1C1C1C1F14EC5D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB37370B470E4EFDBE2E0E0E07887E2689FFD678EC56251A6D369994C26653E9FFFC89ED7792FC732878383838383E3EA98CD661F7957AB55D96EB765BFDF97C3E1F051799DF7722C733297838383838363341A95E5725976BB5D399FCFE5D1C8B1CCC9DCAC699D9B83838383E3B5CAB9686825CF783C2EA7D3E961FEFB91B95993B55F918183838383A3AEE3FE59CB672BD74339A71D8FC7DF365C47D6646D7A0CCDC1C1C1C1C151D79167F2432AF7D4725DF4EAC8DAF4189A8383838383A3AEE3577B869F559EE9AFD7EB72B95C5E76646D7AA4D7902C1C1C1C1C1CDFC7917D619BCDE665C375A4477A7170707070F4EFC8BDAF5CFF647FD8D0911EE9959E1C1C1C1C1CFD3BF26FF6180F1DE971DB938383838383838383838383E3DED1CB75140707070747DDEAE1390E0707070747FDEA651F1907070707C7E7AB97CFB17070707070D475F4F2397A0E0E0E0E8EBA8E5EBEC78B83838383A3AEA397EF11E6E0E0E0E0F89E8E9C8B7AF81D138EF6D9393838FE3C47EE87F5F03B8A1CEF531CEDB37370D472E499FC35FBFDB396DB3D5F1C1C1C1C1C1C8F1CCFF60C7370707070707070707070707070BC5371B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C2D1CF9FBB638383838DEA138DA67FF9963B15894E9745A26934999CFE73FB2E775DECBB1CCE1E0E0E0E0E0B83A66B3D947DED56A55B6DB6DD9EFF7E570387C545EE7BD1CCB9CCCE5E0E0E0E0E0188D4665B95C96DD6E57CEE7737934722C7332376B5AE7E6E0E0E0E078AD722E1A5AC9331E8FCBE9747A98FF7E646ED664ED5764E0E0E0E0E0A8EBB87FD6F2D9CAF550CE69C7E3F1B70DD79135599B1E43737070707070D475E499FC90CA3DB55C17BD3AB2363D86E6E0E0E0E0E0A8EBF8D59EE1679567FAEBF5BA5C2E97971D599B1EE935240B07070707C7F771645FD866B379D9701DE9915E1C1C1C1C1CFD3B72EF2BD73FD91F3674A4477AA5270707070747FF8EFC9B3DC643477ADCF6E4E0E0E0E0E0E0E0E0E0E0E0B877F4721DC5C1C1C1C151B77A788EC3C1C1C1C151BF7AD947C6C1C1C1C1F1F9EAE5732C1C1C1C1C1C751DBD7C8E9E83838383A3AEA397EFF1E2E0E0E0E0A8EBE8E57B843938383838BEA723E7A21E7EC784A37D760E0E8E3FCF91FB613DFC8E22C7FB1447FBEC1C1CB51C79267FCD7EFFACE576CF170707070707C723C7B33DC31C1C1C1C1C1C1C1C1C1C1C1C1C1CEF541CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B07470B47FEBE2D0E0E0E8E77288EF6D97FE6582C16653A9D96C96452E6F3F98FEC799DF7722C73383838383838AE8ED96CF69177B55A95ED765BF6FB7D391C0E1F95D7792FC732277339383838383846A351592E9765B7DB95F3F95C1E8D1CCB9CCCCD9AD6B939383838385EAB9C8B8656F28CC7E3723A9D1EE6BF1F999B3559FB15193838383838EA3AEE9FB57CB6723D9473DAF178FC6DC375644DD6A6C7D01C1C1C1C1C1C751D79263FA4724F2DD745AF8EAC4D8FA1393838383838EA3A7EB567F859E599FE7ABD2E97CBE56547D6A6477A0DC9C2C1C1C1C1F17D1CD917B6D96C5E365C477AA4170707070747FF8EDCFBCAF54FF6870D1DE9915EE9C9C1C1C1C1D1BF23FF668FF1D0911EB73D393838383838383838383838EE1DBD5C477170707070D4AD1E9EE37070707070D4AF5EF69171707070707CBE7AF91C0B07070707475D472F9FA3E7E0E0E0E0A8EBE8E57BBC3838383838EA3A7AF91E610E0E0E0E8EEFE9C8B9A887DF31E1689F9D8383E3CF73E47E580FBFA3C8F13EC5D13E3B07472D479EC95FB3DF3F6BB9DDF3C5C1C1C1C1C1F1C8F16CCF3007070707070707070707070707C73B1547FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1D1C291BF6F8B838383E31D8AA37DF69F39168B45994EA765329994F97CFE237B5EE7BD1CCB1C0E0E0E0E0E8EAB63369B7DE45DAD5665BBDD96FD7E5F0E87C347E575DECBB1CCC95C0E0E0E0E0E8ED1685496CB65D9ED76E57C3E974723C7322773B3A6756E0E0E0E0E8ED72AE7A2A1953CE3F1B89C4EA787F9EF47E6664DD67E45060E0E0E0E8EBA8EFB672D9FAD5C0FE59C763C1E7FDB701D5993B5E931340707070707475D479EC90FA9DC53CB75D1AB236BD363680E0E0E0E0E8EBA8E5FED197E5679A6BF5EAFCBE57279D991B5E9915E43B270707070707C1F47F6856D369B970DD7911EE9C5C1C1C1C1D1BF23F7BE72FD93FD6143477AA4577A7270707070F4EFC8BFD9633C74A4C76D4F0E0E0E0E0E0E0E0E0E0E0E8E7B472FD7511C1C1C1C1C75AB87E7381C1C1C1C1CF5AB977D641C1C1C1C1C9FAF5E3EC7C2C1C1C1C151D7D1CBE7E83938383838EA3A7AF91E2F0E0E0E0E8EBA8E5EBE479883838383E37B3A722EEAE1774C38DA67E7E0E0F8F31CB91FD6C3EF2872BC4F71B4CFCEC151CB9167F2D7ECF7CF5A6EF77C7170707070703C723CDB33CCC1C1C1C1C1C1C1C1C1C1C1C1C1F14EC5D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB37370B470E4EFDBE2E0E0E07887E2689FFD678EC56251A6D369994C26653E9FFFC89ED7792FC732878383838383E3EA98CD661F7957AB55D96EB765BFDF97C3E1F051799DF7722C733297838383838363341A95E5725976BB5D399FCFE5D1C8B1CCC9DCAC699D9B83838383E3B5CAB9686825CF783C2EA7D3E961FEFB91B95993B55F918183838383A3AEE3FE59CB672BD74339A71D8FC7DF365C47D6646D7A0CCDC1C1C1C1C151D79167F2432AF7D4725DF4EAC8DAF4189A8383838383A3AEE3577B869F559EE9AFD7EB72B95C5E76646D7AA4D7902C1C1C1C1C1CDFC7917D619BCDE665C375A4477A7170707070F4EFC8BDAF5CFF647FD8D0911EE9959E1C1C1C1C1CFD3BF26FF6180F1DE971DB938383838383838383838383E3DED1CB75140707070747DDEAE1390E0707070747FDEA651F1907070707C7E7AB97CFB17070707070D475F4F2397A0E0E0E0E8EBA8E5EBEC78B83838383A3AEA397EF11E6E0E0E0E0F89E8E9C8B7AF81D138EF6D9393838FE3C47EE87F5F03B8A1CEF531CEDB37370D472E499FC35FBFDB396DB3D5F1C1C1C1C1C1C8F1CCFF60C7370707070707070707070707070BC5371B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C2D1CF9FBB638383838DEA138DA67FF9963B15894E9745A26934999CFE73FB2E775DECBB1CCE1E0E0E0E0E0B83A66B3D947DED56A55B6DB6DD9EFF7E570387C545EE7BD1CCB9CCCE5E0E0E0E0E0188D4665B95C96DD6E57CEE7737934722C7332376B5AE7E6E0E0E0E078AD722E1A5AC9331E8FCBE9747A98FF7E646ED664ED5764E0E0E0E0E0A8EBB87FD6F2D9CAF550CE69C7E3F1B70DD79135599B1E43737070707070D475E499FC90CA3DB55C17BD3AB2363D86E6E0E0E0E0E0A8EBF8D59EE1679567FAEBF5BA5C2E97971D599B1EE935240B07070707C7F771645FD866B379D9701DE9915E1C1C1C1C1CFD3B72EF2BD73FD91F3674A4477AA5270707070747FF8EFC9B3DC643477ADCF6E4E0E0E0E0E0E0E0E0E0E0E0B877F4721DC5C1C1C1C151B77A788EC3C1C1C1C151BF7AD947C6C1C1C1C1F1F9EAE5732C1C1C1C1C1C751DBD7C8E9E83838383A3AEA397EFF1E2E0E0E0E0A8EBE8E57B843938383838BEA723E7A21E7EC784A37D760E0E8E3FCF91FB613DFC8E22C7FB1447FBEC1C1CB51C79267FCD7EFFACE576CF170707070707C723C7B33DC31C1C1C1C1C1C1C1C1C1C1C1C1C1CEF541CEDB3737070707070707070707070707070B4CFCEC1C1C1C1C1C1C1C1C1C1C1C1C1C1D13E3B070707070707070707070707070747FBEC1C1C1C1C1C1C1C1C1C1C1C1C1C1C1CEDB373707070707070707CA5E37F2784A68E
  4. READ temp1$
  5.  
  6. DIM m AS _MEM, m1 AS _MEM
  7. m = _MEMIMAGE(0) 'a memblock pointing to our screen
  8. m1 = _MEMNEW(LEN(temp1$) / 2) 'a memblock to hold the data
  9. HexToMem temp1$, m1 'unhex it back to a memblock
  10. temp$ = SPACE$(m1.SIZE)
  11. _MEMGET m1, m1.OFFSET, temp$ 'get the unhexed data into a string to hold the unhexed, but still compressed data
  12. _MEMPUT m, m.OFFSET, _INFLATE$(temp$) 'put that uncompressed image onto the screen.
  13.  
  14. SUB HexToMem (hx$, m AS _MEM)
  15.     DIM i AS _INTEGER64
  16.     FOR i = 1 TO LEN(hx$) STEP 2
  17.         h = VAL("&H" + MID$(hx$, i, 2))
  18.         _MEMPUT m, m.OFFSET + i \ 2, h
  19.     NEXT

I'm afraid I get drunk before finishing, and I just can't do it!

(If anyone has issues with the single line of long DATA, let me know and I'll break that down to a few extra lines, but it's honestly not that much -- all of less than 10k characters on that single line.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Count the dots
« Reply #1 on: January 26, 2021, 05:20:01 pm »
Wait... I've not seen those dots before! ;-))

So now you've got them stuck in memory!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Count the dots
« Reply #2 on: January 26, 2021, 05:21:45 pm »
Did you and Fell have a discussion on Discord... Yeah, that ought to keep that old %^%$#$^ Pete busy for awhile!

Hey, sorry, I can't run it on V 1.3, but when I'm ready to dig into the mem stuff, I'll upgrade and have a look see.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Count the dots
« Reply #3 on: January 26, 2021, 05:27:17 pm »
Did you and Fell have a discussion on Discord... Yeah, that ought to keep that old %^%$#$^ Pete busy for awhile!

Hey, sorry, I can't run it on V 1.3, but when I'm ready to dig into the mem stuff, I'll upgrade and have a look see.

Pete
OI.gif


Just for you Pete, you can now play with a screenshot on your browser!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Count the dots
« Reply #4 on: January 26, 2021, 05:32:44 pm »
I get QB64 dots. What do I win?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/