Author Topic: Russian Sorting Halves Danilin  (Read 6808 times)

0 Members and 1 Guest are viewing this topic.

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #30 on: March 29, 2019, 07:01:25 am »
we draw 5D relief creating a random array of heights

on QB64 in 5 minutes and plus in an hour
beauty and versatility

  [ You are not allowed to view this attachment ]  

Code: QB64: [Select]
  1. ' 5d relief and array
  2. SCREEN 12: RANDOMIZE TIMER: DIM a(12,12)
  3. FOR t=1 TO 12 ' quantity
  4.     FOR x=1 TO 12: FOR y=1 TO 12
  5. a(x,y)=INT(RND*20)'heights
  6.     NEXT: NEXT: CLS
  7.     FOR y=1 TO 12: FOR x=1 TO 11
  8. LINE (50+20*x+20*y, 400-20*y-a(x,y))-(50+20*(x+1)+20*y, 400-20*y-a(x+1,y)), y
  9.     NEXT: NEXT
  10.     FOR x=1 TO 12: FOR y=1 TO 11
  11. LINE (50+20*x+20*y, 400-20*y-a(x,y))-(50+20*(x+1)+20*y, 400-20*(y+1)-a(x,y+1)), x
  12.     NEXT: NEXT:SLEEP 1

on C# pendulum program is used
because of what remained incomprehensible lines about timer
and random function depends on outside / inside cycles
and to understand another program created random

how to clear screen is still unclear and builds slowly
and it is unclear how to set color of lines by variables

  [ You are not allowed to view this attachment ]  

still as task manager shows
simple C# program or array fills memory
and only at end does memory clear line save

Code: QB64: [Select]
  1. //RELIEF
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. class RELIEF
  5. {
  6. Form form;
  7.        
  8. int[,] a = new int[22, 22];
  9. static void Main(string[] args)
  10. {
  11. var p = new RELIEF();
  12. }
  13. public RELIEF()
  14. {
  15.         form = new Form() { Text = "RELIEF", Width = 600, Height = 360 };
  16.         timer = new Timer() { Interval = 200 }; // it is not clear
  17.         timer.Tick += delegate(object sender, EventArgs e) // it is not clear
  18.         {
  19.         Random rand = new Random();
  20. // heights
  21.         for (int x = 1; x <=12; x++)
  22.         {
  23.         for (int y = 1; y <=12; y++)
  24.         a[x,y]=rand.Next(20);
  25.         }
  26. // parallels X
  27.         for (int y = 1; y <=12; y++)
  28.         {
  29.         for (int x = 1; x <=11; x++)
  30.                 {
  31.         var x1 = 50 + 20*x + 20*y;
  32.         var y1 = 300 - 20*y - a[x,y];
  33.         var x2 = 50 + 20*(x+1) + 20*y;
  34.         var y2 = 300 - 20*y - a[x+1,y];
  35.  
  36.         Bitmap dblBuffer = new Bitmap(form.Width, form.Height);
  37.         Graphics g = Graphics.FromImage(dblBuffer);
  38.         Graphics f = Graphics.FromHwnd(form.Handle);
  39.  
  40.         g.DrawLine(Pens.Red, new Point(x1, y1), new Point(x2, y2));
  41. //      f.Clear(Color.Green); // clear screen
  42.         f.DrawImage(dblBuffer, new Point(0, 0));
  43.         }
  44.         }
  45. // parallels Y
  46.         for (int x = 1; x <=12; x++)
  47.         {
  48.         for (int y = 1; y <=11; y++)
  49.         {
  50.         var x1 = 50 + 20*x + 20*y;
  51.         var y1 = 300 - 20*y - a[x, y];
  52.         var x2 = 50 + 20*(x+1) + 20*y;
  53.         var y2 = 300 - 20*(y+1) - a[x, y+1];
  54.  
  55.         Bitmap dblBuffer = new Bitmap(form.Width, form.Height);
  56.         Graphics g = Graphics.FromImage(dblBuffer);
  57.         Graphics f = Graphics.FromHwnd(form.Handle);
  58.  
  59.         g.DrawLine(Pens.Red, new Point(x1, y1), new Point(x2, y2));
  60. //      f.Clear(Color.Green); // clear screen
  61.         f.DrawImage(dblBuffer, new Point(0, 0));
  62.         }
  63.         }
  64. Array.Clear(a, 0, 22); // clears memory
  65.         };
  66.         timer.Start(); // it is not clear
  67.         Application.Run(form);
  68.         }        
  69. }

besides C# pendulum is C # diagonal simpler
and no other C# program is included
so as in basic: 1 file = 1 program

that's why my given 5D relief program is important.
drawing at least something predictable
and at same time we study nested loops

and I'm still looking for compilable graphics programs:

1 file = 1 program
1bas=1exe & 1cs=1exe

and already created studies about strings

Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #31 on: April 01, 2019, 05:00:59 am »
1 april

  [ You are not allowed to view this attachment ]  

2019

  [ You are not allowed to view this attachment ]  

? is it easy to draw these pictures on basic & C# ?

http://rosettacode.org/wiki/Category:C_sharp
http://rosettacode.org/wiki/Category:QB64
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
Re: Russian Sorting Halves Danilin
« Reply #32 on: April 02, 2019, 09:52:18 am »
Хилэриэс!

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • Danilin youtube
Re: Russian Sorting Halves Danilin
« Reply #33 on: April 02, 2019, 10:52:33 am »
Valar Dohaeris (c) Game of Thrones - all people should serve

Game of Thrones Simpsons PARODY

Game of Thrones Simpsons PARODY

further we will continue: strings and animation
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself

Offline odin

  • Administrator
  • Newbie
  • Posts: 92
  • I am.
Re: Russian Sorting Halves Danilin
« Reply #34 on: April 06, 2019, 04:13:42 pm »
This thread has been going on for too long spreading on too many different matters and going off topic as well. Start a new thread when a new discussion is required and please remember to stay on topic - this board is for QB64 discussion.
« Last Edit: April 06, 2019, 04:21:32 pm by odin »