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. is it possible?

is it possible?

Scheduled Pinned Locked Moved JavaScript
javajavascriptvisual-studiohelpquestion
40 Posts 4 Posters 3 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.
  • H Hakan Bulut

    Yes JavaScript is not give an output

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

    I had a look at your web server code and tried to figure out Random bits. You do understand these are not finished code? Just "Work in progress", but I'm not getting much response as usual. :doh:

    function RandomNumber() {
    var IsToken = [
    [ 9,10,38,40,46,48],
    [11,40,42,45,47,48],
    [ 1,19,26,30,31,48]
    ];

    var MAX\_WEEKS  = 3; // array can now be extended, avoids (future) problems ;)
    var MAX\_DATA   = 50;
    var items      = 1;
    var items2     = 1;
    var scope;
    var dups       = new Array(MAX\_DATA); 
    var nodups     = new Array(MAX\_DATA); // \*\* NEW \*\*
    var lucky      = new Array(MAX\_DATA);
    var arr        = \[\];
    
    //===================================
    for (var i=0; i < MAX\_DATA; i++) {
         dups\[i\]=0;
    }
    //===================================
    
    // ArrIns can be dealt with in exactly the same way
    // as before it's just easier to manage changes
    for (var week=0; week < MAX\_WEEKS; week++) {
    //document.write("items= "+ items);
    
      for (var j=0; j < 6; j++) {
          var x = IsToken\[week\]\[j\];
                    
          if(dups\[x\] == 0) {
              //document.write("yes: "+ x +" "+ items);
              dups\[x\]  = x; // replaces boolean with actual value (non-zero == used)
              nodups\[items\] = x;
              items++;
          } else {
              //document.write("no: "+ x);
          }
    
      } // loop-j
    
    } // loop-week
    
    // \*\*\* NEW \*\*\* - no duplicates, now sort them
    nodups.sort(function(a,b){return a-b;});
            
    /\* copied from IsToken\[\]\[\] with any duplicates removed \*/
    document.write("  
    

    numbers: (without duplicates)
    ");
    for (var i=0; i < items-1; i++) {
    document.write(nodups[i] +" ");
    }

    /\* array used for tracking duplicates & used by random.
       int instead of boolean.
    \*/
    document.writeln("  
    

    ");
    document.write("
    used numbers:
    ");

    for (var i=1; i < 50; i++) {
         if (dups\[i\] == 0) {
            arr\[items2++\] = i;
         } else {
            arr\[items2++\] = 0;
         }
        document.write(dups\[i\] +" ");
    }
    
    document.writeln("  
    

    ");
    document.writeln("
    unused numbers:
    ");

    for (var i=1; i < items2; i++) {
        document.write(arr\[i\] +" ");
    }
    
    document.writeln("  
    

    ");

    /\* watch when arr\[q\] = 0 (gets value of q which is in IsToken\[\])
     \* 
     \* NEW :
    
    H 1 Reply Last reply
    0
    • D dusty_dex

      I had a look at your web server code and tried to figure out Random bits. You do understand these are not finished code? Just "Work in progress", but I'm not getting much response as usual. :doh:

      function RandomNumber() {
      var IsToken = [
      [ 9,10,38,40,46,48],
      [11,40,42,45,47,48],
      [ 1,19,26,30,31,48]
      ];

      var MAX\_WEEKS  = 3; // array can now be extended, avoids (future) problems ;)
      var MAX\_DATA   = 50;
      var items      = 1;
      var items2     = 1;
      var scope;
      var dups       = new Array(MAX\_DATA); 
      var nodups     = new Array(MAX\_DATA); // \*\* NEW \*\*
      var lucky      = new Array(MAX\_DATA);
      var arr        = \[\];
      
      //===================================
      for (var i=0; i < MAX\_DATA; i++) {
           dups\[i\]=0;
      }
      //===================================
      
      // ArrIns can be dealt with in exactly the same way
      // as before it's just easier to manage changes
      for (var week=0; week < MAX\_WEEKS; week++) {
      //document.write("items= "+ items);
      
        for (var j=0; j < 6; j++) {
            var x = IsToken\[week\]\[j\];
                      
            if(dups\[x\] == 0) {
                //document.write("yes: "+ x +" "+ items);
                dups\[x\]  = x; // replaces boolean with actual value (non-zero == used)
                nodups\[items\] = x;
                items++;
            } else {
                //document.write("no: "+ x);
            }
      
        } // loop-j
      
      } // loop-week
      
      // \*\*\* NEW \*\*\* - no duplicates, now sort them
      nodups.sort(function(a,b){return a-b;});
              
      /\* copied from IsToken\[\]\[\] with any duplicates removed \*/
      document.write("  
      

      numbers: (without duplicates)
      ");
      for (var i=0; i < items-1; i++) {
      document.write(nodups[i] +" ");
      }

      /\* array used for tracking duplicates & used by random.
         int instead of boolean.
      \*/
      document.writeln("  
      

      ");
      document.write("
      used numbers:
      ");

      for (var i=1; i < 50; i++) {
           if (dups\[i\] == 0) {
              arr\[items2++\] = i;
           } else {
              arr\[items2++\] = 0;
           }
          document.write(dups\[i\] +" ");
      }
      
      document.writeln("  
      

      ");
      document.writeln("
      unused numbers:
      ");

      for (var i=1; i < items2; i++) {
          document.write(arr\[i\] +" ");
      }
      
      document.writeln("  
      

      ");

      /\* watch when arr\[q\] = 0 (gets value of q which is in IsToken\[\])
       \* 
       \* NEW :
      
      H Offline
      H Offline
      Hakan Bulut
      wrote on last edited by
      #32

      public static int Random(int nu)
      {
      final int MAX_DATA = 49;
      nu = (int) Math.round(MAX_DATA * Math.random()+1);
      for(int j=0; j

      I thought to a simple processor firstData argument to match unwanted the same numbers. Have you previously worked on the first data? Type missmatch syntax error of return line.

      D 1 Reply Last reply
      0
      • H Hakan Bulut

        public static int Random(int nu)
        {
        final int MAX_DATA = 49;
        nu = (int) Math.round(MAX_DATA * Math.random()+1);
        for(int j=0; j

        I thought to a simple processor firstData argument to match unwanted the same numbers. Have you previously worked on the first data? Type missmatch syntax error of return line.

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

        Hakan Bulut wrote:

        Have you previously worked on the first data? Type missmatch syntax error of return line.

        I'm not sure what that means. If you meant have I written this in Java? then no. I was waiting for more detail from you. :)

        H 1 Reply Last reply
        0
        • D dusty_dex

          Hakan Bulut wrote:

          Have you previously worked on the first data? Type missmatch syntax error of return line.

          I'm not sure what that means. If you meant have I written this in Java? then no. I was waiting for more detail from you. :)

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

          As stated before, you have wrote in the language of your javascript if (! taken [arr [q]]) ! operator the language of java what can be done instead of ? It is not valid in Java.. I was playing new Tomb Raider the game it is really wonderful game. This is really beyond of programming.. That is no any using the combination of 6/49 tried to write random column.

          D 1 Reply Last reply
          0
          • H Hakan Bulut

            As stated before, you have wrote in the language of your javascript if (! taken [arr [q]]) ! operator the language of java what can be done instead of ? It is not valid in Java.. I was playing new Tomb Raider the game it is really wonderful game. This is really beyond of programming.. That is no any using the combination of 6/49 tried to write random column.

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

            All relative and assignment operators in Java are the same in C/C++ and Javascript. give me the error messages, code line numbers and current code so that I can see where the problem is. Did you get the email is sent you? I will send you something very helpful. I've never played tomb raider, strange huh? But I do like those kind of games. :-D

            H 1 Reply Last reply
            0
            • D dusty_dex

              All relative and assignment operators in Java are the same in C/C++ and Javascript. give me the error messages, code line numbers and current code so that I can see where the problem is. Did you get the email is sent you? I will send you something very helpful. I've never played tomb raider, strange huh? But I do like those kind of games. :-D

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

              Error is: Type missmatch: cannot convert from boolean to int. at this line:

              return (nu != arr[j]);

              My e-mail address is: hakanbul@hotmail.com

              D 2 Replies Last reply
              0
              • H Hakan Bulut

                Error is: Type missmatch: cannot convert from boolean to int. at this line:

                return (nu != arr[j]);

                My e-mail address is: hakanbul@hotmail.com

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

                Hakan you will get spammed posting your email address like that. I already know your email (it was on the file combinations.js on your website) I sent you an email message on Monday. Have you seen it?

                1 Reply Last reply
                0
                • H Hakan Bulut

                  Error is: Type missmatch: cannot convert from boolean to int. at this line:

                  return (nu != arr[j]);

                  My e-mail address is: hakanbul@hotmail.com

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

                  The function is expected to return int

                  public static int Random(int nu)

                  Any boolean test (== != > >= < <=) will give true/false answer, not the int. That is your mismatch.

                  public static int Random(int nu)
                  {
                  int see;
                  final int MAX_DATA = 49;
                  nu = (int) Math.round(MAX_DATA * Math.random()+1);
                  for(int j=0; j

                  H 1 Reply Last reply
                  0
                  • D dusty_dex

                    The function is expected to return int

                    public static int Random(int nu)

                    Any boolean test (== != > >= < <=) will give true/false answer, not the int. That is your mismatch.

                    public static int Random(int nu)
                    {
                    int see;
                    final int MAX_DATA = 49;
                    nu = (int) Math.round(MAX_DATA * Math.random()+1);
                    for(int j=0; j

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

                    did not resolve to problem.. "Cannot cast from boolean to int." Compiler wrong alert give to message. I am thinking to must have a boolean initializier to int

                    D 1 Reply Last reply
                    0
                    • H Hakan Bulut

                      did not resolve to problem.. "Cannot cast from boolean to int." Compiler wrong alert give to message. I am thinking to must have a boolean initializier to int

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

                      check your email. ;)

                      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