www.webdeveloper.com
Results 1 to 15 of 32

Thread: Sudoku Game Help

Threaded View

  1. #29
    Join Date
    Sep 2007
    Posts
    390
    Code:
      
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
    <meta http-equiv="content-language" content="tr" >
    <style type="text/css">
    table input {width:40px; height:40px;text-align:center; font-size:16px; font-weight:bold;}
    .sag { border-right:thick double #dedede;} /* http://www.w3schools.com/cssref/pr_border-right.asp  */
    .uc {  border-right:thick double #babada;  border-bottom:thick double #bacada;}
    .alt {  border-bottom:thick double #babaca;}
    .arkarenk { background-color: #ceb; }
    .arkarenk2 { background-color: #aff; }
    .arkarenk3 { background-color: #defaad; }
    .arkarenk4 { background-color: #ade; }
    .arkarenk5 { background-color: #cafcaf; }
    .arkarenk6 { background-color: #abd; }
    .arkarenk7 { background-color: #afa; }
    .arkarenk8 { background-color: #bed; }
    .arkarenk9 { background-color: #ada; }
    .yeni {font-size:24px;background-color: #ebcede; color:#def;}
    .kolay {font-family:"Times New Roman", Times, serif; 
    font-size:24px;
    text-align:center; color:#bab;border:4px solid #fab;
    width:400px; height:50px; background-color:#ced; }
    
    </style>
    
    <script type="text/javascript">
    // http://www.webdeveloper.com/forum/showthread.php?275573-Sudoku-Game-Help/page2
    
    var A;
    function sudokuYap () {
    
    // var n= [1,2,3,4,5,6,7,8,9];
    // n dizisindeki elemanları rastgele diziyorum.
    var n= [1,2,3,4,5,6,7,8,9].sort( function() { return 0.5 - Math.random() } );
    
    // A dizisi içine n dizisinin elemanlarını hangi sırayla yerletireceğimi belirliyorum.
    A=  [n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[3],n[4],n[5],n[6],n[7],n[8],n[0],n[1],n[2],n[6],n[7],n[8],n[0],n[1],n[2],n[3],n[4],n[5],n[1],n[2],n[0],n[4],n[5],n[3],n[7],n[8],n[6],n[4],n[5],n[3],n[7],n[8],n[6],n[1],n[2],n[0],n[7],n[8],n[6],n[1],n[2],n[0],n[4],n[5],n[3],n[2],n[0],n[1],n[5],n[3],n[4],n[8],n[6],n[7],n[5],n[3],n[4],n[8],n[6],n[7],n[2],n[0],n[1],n[8],n[6],n[7],n[2],n[0],n[1],n[5],n[3],n[4]];
    
    // rastgele belirlenecek 30 inputa, değer atayayım.
    var el;
       for(var p=0; p<30; p++) {
       r= Math.floor(Math.random()*81);
       el= document.getElementById("s" + (r+1) ); 
       el.value = A[r]; 
       el.style.color="blue";
       }
    
    }
    
    // Tablodaki açılmamış 5 tane inputun değerini göstereyim.
    function ipucu() {
    var r;
    var say=0;
    var el;
       for(var k=0; k<81; k++) {
       r= Math.floor(Math.random()*81);
        el= document.getElementById("s" + (r+1)); 
        if(el.value=='') { el.value = A[r];  el.style.color="coral"; say++; }
        if(say == 5 ) { break; }  
       }
    
    }
    
    
    // Tablodaki tüm input elemanlarının değerini temizleyip yeni sudoku yapılması için fonksiyonu çağırayım.
    function temizle() {
    
    var el, k;
       for( k=0; k<81; k++) {
       
        el= document.getElementById("s" + (k+1)); 
        el.value = '';  
        el.style.color="black";
       }
    
    sudokuYap();
    }
    
    </script>
    
    </head>
    <body>
    
    <table align="center"> 
    <tr>
    <td class="sag arkarenk">
    <input type="text" id="s1">
    <input type="text" id="s2">
    <input type="text" id="s3">
    </td><td class="sag arkarenk2">
    <input type="text" id="s4">
    <input type="text" id="s5">
    <input type="text" id="s6">
    </td><td class="arkarenk3">
    <input type="text" id="s7">
    <input type="text" id="s8">
    <input type="text" id="s9">
    </td></tr>
    <tr>
    <td class="sag arkarenk">
    <input type="text" id="s10">
    <input type="text" id="s11">
    <input type="text" id="s12">
    </td><td class="sag arkarenk2">
    <input type="text" id="s13">
    <input type="text" id="s14">
    <input type="text" id="s15">
    </td><td class="arkarenk3">
    <input type="text" id="s16">
    <input type="text" id="s17">
    <input type="text" id="s18">
    </td></tr>
    <tr>
    <td class="uc arkarenk">
    <input type="text" id="s19">
    <input type="text" id="s20">
    <input type="text" id="s21">
    </td><td class="uc arkarenk2">
    <input type="text" id="s22">
    <input type="text" id="s23">
    <input type="text" id="s24">
    </td><td class="alt arkarenk3">
    <input type="text" id="s25">
    <input type="text" id="s26">
    <input type="text" id="s27">
    </td></tr>
    <tr>
    <td class="sag arkarenk4">
    <input type="text" id="s28">
    <input type="text" id="s29">
    <input type="text" id="s30">
    </td><td class="sag arkarenk5">
    <input type="text" id="s31">
    <input type="text" id="s32">
    <input type="text" id="s33">
    </td><td class="arkarenk6">
    <input type="text" id="s34">
    <input type="text" id="s35">
    <input type="text" id="s36">
    </td></tr>
    <tr>
    <td class="sag arkarenk4">
    <input type="text" id="s37">
    <input type="text" id="s38">
    <input type="text" id="s39">
    </td><td class="sag arkarenk5">
    <input type="text" id="s40">
    <input type="text" id="s41">
    <input type="text" id="s42">
    </td><td class="arkarenk6">
    <input type="text" id="s43">
    <input type="text" id="s44">
    <input type="text" id="s45">
    </td></tr>
    <tr>
    <td class="uc arkarenk4">
    <input type="text" id="s46">
    <input type="text" id="s47">
    <input type="text" id="s48">
    </td><td class="uc arkarenk5">
    <input type="text" id="s49">
    <input type="text" id="s50">
    <input type="text" id="s51">
    </td><td class="alt arkarenk6">
    <input type="text" id="s52">
    <input type="text" id="s53">
    <input type="text" id="s54">
    </td></tr>
    <tr>
    <td class="sag arkarenk7">
    <input type="text" id="s55">
    <input type="text" id="s56">
    <input type="text" id="s57">
    </td><td class="sag arkarenk8">
    <input type="text" id="s58">
    <input type="text" id="s59">
    <input type="text" id="s60">
    </td><td class="arkarenk9">
    <input type="text" id="s61">
    <input type="text" id="s62">
    <input type="text" id="s63">
    </td></tr>
    <tr>
    <td class="sag arkarenk7">
    <input type="text" id="s64">
    <input type="text" id="s65">
    <input type="text" id="s66">
    </td><td class="sag arkarenk8">
    <input type="text" id="s67">
    <input type="text" id="s68">
    <input type="text" id="s69">
    </td><td class="arkarenk9">
    <input type="text" id="s70">
    <input type="text" id="s71">
    <input type="text" id="s72">
    </td></tr>
    <tr>
    <td class="sag arkarenk7">
    <input type="text" id="s73">
    <input type="text" id="s74">
    <input type="text" id="s75">
    </td><td class="sag arkarenk8">
    <input type="text" id="s76">
    <input type="text" id="s77">
    <input type="text" id="s78">
    </td><td class="arkarenk9">
    <input type="text" id="s79">
    <input type="text" id="s80">
    <input type="text" id="s81">
    </td></tr>
    </table>
    <br>
    <div align="center">
    <input type="button" value="yeni sudoku" onclick="temizle()" class="yeni"><br><br>
    
    <input type="button" value="Her zorlukla birlikte bir kolaylık vardır." onclick="ipucu()" class="kolay" >
    <br><br><br>
    Sudokuyu çözerken yardıma ihtiyacın olursa "Her zorlukla birlikte bir kolaylık vardır" butonuna tıklayarak yardım alabilirsin!
    </div>
    <script type="text/javascript">
    
    sudokuYap();
    
    </script>
    
    </body>
    </html>
    Last edited by Ayşe; 04-14-2013 at 05:10 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.30188 seconds
  • Memory Usage 4,319KB
  • Queries Executed 14 (?)
More Information
Template Usage (31):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (22)bbcode_code
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (30)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (30)postbit
  • (30)postbit_onlinestatus
  • (30)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (27):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./includes/functions_threadedmode.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates