Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. JavaScript
  4. Question of a dusy_dex

Question of a dusy_dex

Scheduled Pinned Locked Moved JavaScript
helpquestionjavascriptdata-structurestools
27 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    Anlamıyorum!

    Use the best guess

    H Offline
    H Offline
    Hakan Bulut
    wrote on last edited by
    #13

    Anlamadığınız şey nedir?

    L 1 Reply Last reply
    0
    • H Hakan Bulut

      Anlamadığınız şey nedir?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #14

      Just about all your comments. I appreciate that English is not your native language, but you may like to find a better translator.

      Use the best guess

      1 Reply Last reply
      0
      • H Hakan Bulut

        I am living in turkey.. You are older than me 1 year :) I'm 39 years old. Me hakan and Glad to meet you Thankyou for everything... and issue is not computer literature word.

        D Offline
        D Offline
        dusty_dex
        wrote on last edited by
        #15

        Hello. :-D I am a bit older than 40. the greater than symbol (>) was a clue. :) Benim kod tamam mı? Have a go with Bing translator www.bing.com/translator Proje kodu Yöneticiler üzgün değil deneyin. :wtf:

        "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

        1 Reply Last reply
        0
        • D dusty_dex

          Are you trying to copy the numbers so that you start another week's draw? You can't use delete that way for arrays elements. But your code still doesn't make any sense. There are no shortcuts to comparing *all* elements of one array using one command. You need to compare each element of arrIns one by one, with oel[i] then copy *that element* to arr

          var arr = []; // You do *not* need to use new Array
          var c = 0;

          for (var i=0; i < oel.length; i++) {
          var e = 0;
          while (e < arrIns.length) {
          if (oel[i] != arrIns[e]) {
          arr[c] = oel[i];
          c++;
          }
          e++;
          } // while-loop

          } // for-loop
          oel.length = 0; // reset oel array length to zero, so that you can use the array again

          "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

          H Offline
          H Offline
          Hakan Bulut
          wrote on last edited by
          #16

          I just got a 39, in march 02 :).. I think there is a little misunderstanding here. 1 ... 49 number of the remaining elements of the numbers array of the last 3 weeks trying to get the lucky numbers, I was try to do, just as.

          if(oel[i] != arrIns[11])
          { oel[i]; }; // When i wrote document.write(oel[i] code in this line I can archive these numbers.

          delete oel[i];

          Quote:

          that is exactly the last 3 weeks I wanted to get back remaining array of numbers. The number that is 49 - 18 = 31

          D 2 Replies Last reply
          0
          • H Hakan Bulut

            I just got a 39, in march 02 :).. I think there is a little misunderstanding here. 1 ... 49 number of the remaining elements of the numbers array of the last 3 weeks trying to get the lucky numbers, I was try to do, just as.

            if(oel[i] != arrIns[11])
            { oel[i]; }; // When i wrote document.write(oel[i] code in this line I can archive these numbers.

            delete oel[i];

            Quote:

            that is exactly the last 3 weeks I wanted to get back remaining array of numbers. The number that is 49 - 18 = 31

            D Offline
            D Offline
            dusty_dex
            wrote on last edited by
            #17

            [ I am mostly working from my memory, and it is getting difficult. ] Ben çok benim hafızasından çalışıyorum ve bu zor gidiyor. Yani, bu ekler:

            // add this after the line } // while-loop
            document.write(arr.toString());

            [ Let me know if that output is what you expected. If not you will have to try posting your current code, so that I can see it all in one go, and not have to try an put this all together in my head ] Bu çıktı beklediğiniz ise bizi. Aksi takdirde, geçerli deftere nakil ki ben her tek seferde görmek ve bir yerine hep birlikte kafamın içinde denemek zorunda değil denemek gerekecek. :sigh:

            "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

            H 2 Replies Last reply
            0
            • H Hakan Bulut

              I just got a 39, in march 02 :).. I think there is a little misunderstanding here. 1 ... 49 number of the remaining elements of the numbers array of the last 3 weeks trying to get the lucky numbers, I was try to do, just as.

              if(oel[i] != arrIns[11])
              { oel[i]; }; // When i wrote document.write(oel[i] code in this line I can archive these numbers.

              delete oel[i];

              Quote:

              that is exactly the last 3 weeks I wanted to get back remaining array of numbers. The number that is 49 - 18 = 31

              D Offline
              D Offline
              dusty_dex
              wrote on last edited by
              #18

              [ I originally asked you (in your earlier posts) ] Başlangıçta (önceki mesaj) sordum Q1. nasıl ne zaman rasgele şanslı numaraları öncekilerin yerine üretilen karar veriyorsunuz? S2. Yeni piyango numarası + şanslı numaraları (otomatik olarak) geçerli tarihi & zamanında üretilmektedir? [ The problem as I see it, is that you need some *automatic* method to keep track of the current week's lucky numbers, and discard the oldest. Week-2 I did it that way with my BASIC program 20+ years ago so that I wouldn't need to keep adjusting the code for extra 6 numbers every week. ] Sorun görüyorum, bazı ihtiyacınız olduğunu * otomatik * yöntem geçerli haftaki şanslı numaralar izlemenize ve en eski atmak için. Hafta-2 Ben fazladan 6 sayı kodunu ayarlama tutmak gerek olmaz bu şekilde temel programım ile 20 + yıl önce her hafta yaptım. [ is the translator good? ] Çevirmen iyi mi?

              "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

              H 1 Reply Last reply
              0
              • D dusty_dex

                [ I originally asked you (in your earlier posts) ] Başlangıçta (önceki mesaj) sordum Q1. nasıl ne zaman rasgele şanslı numaraları öncekilerin yerine üretilen karar veriyorsunuz? S2. Yeni piyango numarası + şanslı numaraları (otomatik olarak) geçerli tarihi & zamanında üretilmektedir? [ The problem as I see it, is that you need some *automatic* method to keep track of the current week's lucky numbers, and discard the oldest. Week-2 I did it that way with my BASIC program 20+ years ago so that I wouldn't need to keep adjusting the code for extra 6 numbers every week. ] Sorun görüyorum, bazı ihtiyacınız olduğunu * otomatik * yöntem geçerli haftaki şanslı numaralar izlemenize ve en eski atmak için. Hafta-2 Ben fazladan 6 sayı kodunu ayarlama tutmak gerek olmaz bu şekilde temel programım ile 20 + yıl önce her hafta yaptım. [ is the translator good? ] Çevirmen iyi mi?

                "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                H Offline
                H Offline
                Hakan Bulut
                wrote on last edited by
                #19

                You were right .. has no need to use new delete method to do this.

                D 3 Replies Last reply
                0
                • H Hakan Bulut

                  You were right .. has no need to use new delete method to do this.

                  D Offline
                  D Offline
                  dusty_dex
                  wrote on last edited by
                  #20

                  [ Overall, how is it looking? OK? ] Genel olarak, ne arıyor? Tamam?

                  "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                  1 Reply Last reply
                  0
                  • D dusty_dex

                    [ I am mostly working from my memory, and it is getting difficult. ] Ben çok benim hafızasından çalışıyorum ve bu zor gidiyor. Yani, bu ekler:

                    // add this after the line } // while-loop
                    document.write(arr.toString());

                    [ Let me know if that output is what you expected. If not you will have to try posting your current code, so that I can see it all in one go, and not have to try an put this all together in my head ] Bu çıktı beklediğiniz ise bizi. Aksi takdirde, geçerli deftere nakil ki ben her tek seferde görmek ve bir yerine hep birlikte kafamın içinde denemek zorunda değil denemek gerekecek. :sigh:

                    "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                    H Offline
                    H Offline
                    Hakan Bulut
                    wrote on last edited by
                    #21

                    // add this after the line } // while-loop
                    document.write(arr.toString());
                    //instead of arr[add++] method is better useful in this line.

                    I have just wanted to do this.

                    var arrIns = [ "1","21","24","28","42","48",
                    "12","23","34","36","37","46",
                    "3","18","19","25","44","45" ];

                    var arrLot = [];
                    var arr = [];
                    var add = 0;

                    for(var i=1; i<50; i++)
                    {
                    arrLot[i] = i;
                    if(arrLot[i] != arrIns[0])
                    if(arrLot[i] != arrIns[1])
                    if(arrLot[i] != arrIns[2])
                    if(arrLot[i] != arrIns[3])
                    if(arrLot[i] != arrIns[4])
                    if(arrLot[i] != arrIns[5])
                    if(arrLot[i] != arrIns[6])
                    if(arrLot[i] != arrIns[7])
                    if(arrLot[i] != arrIns[8])
                    if(arrLot[i] != arrIns[9])
                    if(arrLot[i] != arrIns[10])
                    if(arrLot[i] != arrIns[11])
                    if(arrLot[i] != arrIns[12])
                    if(arrLot[i] != arrIns[13])
                    if(arrLot[i] != arrIns[14])
                    if(arrLot[i] != arrIns[15])
                    if(arrLot[i] != arrIns[16])
                    if(arrLot[i] != arrIns[17])
                    if(arrLot[i] != arrIns[18])
                    if(arrLot[i] != arrIns[19])
                    { arr[add++] = arrLot[i];}
                    }

                    // create and initialise - array to keep track of any number taken
                    var taken = new Array(49);
                    for (var i=49; i>0; i--) taken[i]=false;

                    var lucky = \[\];
                    var z     = 0;
                    
                    do{
                        var q = Math.round(31 \* Math.random());
                        if(!taken\[arr\[q\]\]) {
                            lucky\[z\] = arr\[q\];
                            taken\[arr\[q\]\] = true;
                            document.write(lucky\[z\] + "  ");
                            z++;
                        }
                    }while(z<6);
                    
                    D 1 Reply Last reply
                    0
                    • H Hakan Bulut

                      // add this after the line } // while-loop
                      document.write(arr.toString());
                      //instead of arr[add++] method is better useful in this line.

                      I have just wanted to do this.

                      var arrIns = [ "1","21","24","28","42","48",
                      "12","23","34","36","37","46",
                      "3","18","19","25","44","45" ];

                      var arrLot = [];
                      var arr = [];
                      var add = 0;

                      for(var i=1; i<50; i++)
                      {
                      arrLot[i] = i;
                      if(arrLot[i] != arrIns[0])
                      if(arrLot[i] != arrIns[1])
                      if(arrLot[i] != arrIns[2])
                      if(arrLot[i] != arrIns[3])
                      if(arrLot[i] != arrIns[4])
                      if(arrLot[i] != arrIns[5])
                      if(arrLot[i] != arrIns[6])
                      if(arrLot[i] != arrIns[7])
                      if(arrLot[i] != arrIns[8])
                      if(arrLot[i] != arrIns[9])
                      if(arrLot[i] != arrIns[10])
                      if(arrLot[i] != arrIns[11])
                      if(arrLot[i] != arrIns[12])
                      if(arrLot[i] != arrIns[13])
                      if(arrLot[i] != arrIns[14])
                      if(arrLot[i] != arrIns[15])
                      if(arrLot[i] != arrIns[16])
                      if(arrLot[i] != arrIns[17])
                      if(arrLot[i] != arrIns[18])
                      if(arrLot[i] != arrIns[19])
                      { arr[add++] = arrLot[i];}
                      }

                      // create and initialise - array to keep track of any number taken
                      var taken = new Array(49);
                      for (var i=49; i>0; i--) taken[i]=false;

                      var lucky = \[\];
                      var z     = 0;
                      
                      do{
                          var q = Math.round(31 \* Math.random());
                          if(!taken\[arr\[q\]\]) {
                              lucky\[z\] = arr\[q\];
                              taken\[arr\[q\]\] = true;
                              document.write(lucky\[z\] + "  ");
                              z++;
                          }
                      }while(z<6);
                      
                      D Offline
                      D Offline
                      dusty_dex
                      wrote on last edited by
                      #22

                      [ But, isn't arrIns just going to keep getting longer every week? ] Ama arrIns sadece her hafta uzun elde tutmak için gitmiyor? [ Can you please explain what purpose is of the arrLot array, does it replace oel from last code you gave?.] Lütfen arrLot dizi oel verdiği son kodundan yerine yok amaç ne olduğunu açıklayabilir misiniz? [ One thing I am not understanding, and I have kept asking you information about, is the carry over from one week to another. That's what your code appears to be doing, but without a clear understanding, I cannot begin to grasp the way you intend manage this code any length of time. Please use the translator and give me an over view of the whole lotto process you are trying to achieve. And the methods you are using to develop with. ] :| Bir şey ben değil anlamak, ve hakkında bilgi isteyen tutmuş, taşıma üzerinden bir hafta başka olduğunu. Bu ne yapıyor olması kodunuzu görünür, ama net bir anlayış olmadan, ben uzun süre bu kodu yönetmek istediğiniz şekilde kavramak başlar olamaz. Çevirmen ve vermek beni bir yere görüntülemek tüm Loto süreci size ulaşmak için çalışıyoruz kullanın lütfen. Ve ile geliştirmek için kullandığınız yöntemleri. :)

                      "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                      1 Reply Last reply
                      0
                      • H Hakan Bulut

                        You were right .. has no need to use new delete method to do this.

                        D Offline
                        D Offline
                        dusty_dex
                        wrote on last edited by
                        #23

                        I have left the arrLot array alone for now. But this is my guess

                        = i

                        // **NEW** add leading zero to numbers < 10
                        function zeroAdjust(n) {
                        var t = "0"+n;
                        return t.substring(t.length-2,t.length);
                        }

                        // these also need leading zero if < 10
                        var arrIns = [ "01","21","24","28","42","48",
                        "12","23","34","36","37","46",
                        "03","18","19","25","44","45" ];

                        var allLucky = arrIns.toString();

                        var arrLot = [];
                        var arr = [];
                        var count = 0;
                        var t;
                        for(var i=1; i<50; i++)
                        {
                        // force i to string then
                        // compare i with all lucky numbers
                        if (allLucky.indexOf(zeroAdjust(i)) == -1 ) {
                        arr[count] = i; // add +""
                        count++;
                        }
                        } // for-loop

                        document.write("length of arr[] ="+ count +"
                        ");

                        I have provided this just to help you move forward (if my guess was correct) here are some more bits of code for you to look at. csv = comma,separated,values which is what you get with an array.toString() call. :)

                        //========== EXAMPLE ===============
                        // Save & Restore an array
                        var arrIns = [ "01","21","24","28","42","48",
                        "12","23","34","36","37","46",
                        "03","18","19","25","44","45" ];

                        var arr_to_csv = arrIns.toString();
                        document.write(arr_to_csv);

                        var arr_from_csv = [];
                        var tmp = arr_to_csv.split(",");

                        for (var i=0; i < tmp.length; i++) {
                        arr_from_csv[i] = parseInt( tmp[i]);
                        document.write(arr_from_csv[i]);
                        }
                        //====================================

                        The following code has arrIns as a N-dimensional array (3x6) of numbers, but it would complicate the code for comparisons, like the allLucky string compare above.

                        //========== EXAMPLE ===============
                        // arrIns array of 3 x 6 (not "strings")
                        var arrIns = [ [ 1,21,24,28,42,48],
                        [12,23,34,36,37,46],
                        [ 3,18,19,25,44,45]
                        ];

                        document.write("lucky numbers, one week at a time
                        ");
                        for (var week=1; week < 4; week++) {
                        document.write("week no: "+ week +"
                        ");

                        for (var i=0; i < 6; i++) {
                        document.write(arrIns[week-1][i]);
                        }
                        }
                        //====================================

                        :-D

                        "It's true that hard work never killed anyone. But I figure, why take the chance." - R

                        1 Reply Last reply
                        0
                        • H Hakan Bulut

                          You were right .. has no need to use new delete method to do this.

                          D Offline
                          D Offline
                          dusty_dex
                          wrote on last edited by
                          #24

                          Check the code project website for code changes. :)

                          "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                          H 1 Reply Last reply
                          0
                          • D dusty_dex

                            Check the code project website for code changes. :)

                            "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                            H Offline
                            H Offline
                            Hakan Bulut
                            wrote on last edited by
                            #25

                            Ok... Good coding and good idea.. I will try these codes right now. :)

                            1 Reply Last reply
                            0
                            • D dusty_dex

                              [ I am mostly working from my memory, and it is getting difficult. ] Ben çok benim hafızasından çalışıyorum ve bu zor gidiyor. Yani, bu ekler:

                              // add this after the line } // while-loop
                              document.write(arr.toString());

                              [ Let me know if that output is what you expected. If not you will have to try posting your current code, so that I can see it all in one go, and not have to try an put this all together in my head ] Bu çıktı beklediğiniz ise bizi. Aksi takdirde, geçerli deftere nakil ki ben her tek seferde görmek ve bir yerine hep birlikte kafamın içinde denemek zorunda değil denemek gerekecek. :sigh:

                              "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                              H Offline
                              H Offline
                              Hakan Bulut
                              wrote on last edited by
                              #26

                              Yes.. You are working really hard issue on!.. This is really hard to comes true in JavaScript language.

                              D 1 Reply Last reply
                              0
                              • H Hakan Bulut

                                Yes.. You are working really hard issue on!.. This is really hard to comes true in JavaScript language.

                                D Offline
                                D Offline
                                dusty_dex
                                wrote on last edited by
                                #27

                                [ I was thinking back to my first reply to this thread of yours: ] Iyi, ben bu konuyu senin ilk zaman cevap geri düşünüyordum: Reading-a-text-file-in-JS [ and thought that maybe you intend to use external file with previous week's data, using string data. Yes?] ve düşündüğünüz hafta önceki verileri, dış dosya kullanılacak dize verileri kullanarak belki düşündüm. Evet? [ Anyhow, keep me informed of any problems. ] Her neyse, bana herhangi bir sorunları haberdar tutmak. :)

                                "It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan That's what machines are for. Got a problem? Sleep on it.

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups