JavaScript - Game Engine Question..
I'm trying to build a small chess like gaming engine, and i'm wondering what soulution would be better. To try and create the whole board in javascript, or to use flash instead!
Problem is that is that i kinda don't have money to buy adobe/macromedia/flash but javascript could be a bit more difficult couse of browser limitations.. Similar TutorialsThis is a simple basic game i want to make. Its a "What Am I" Riddle... The questions is (In HTML which i already know): I'm as light as a feather but no man can hold me for long. What am I? the answer is: Your Breath. (This is where the JAVASCRIPT comes in) Lets say they guess a rock, have a pop up say: Wrong Answer. Please try again. Lets say they guess Your breath -OR- Breath, have a pop up say: Correct! I want a text field where you can enter your answer, and if they choose ANYTHING but the 2 correct answers above, it will display please try again. Can anyone code this please? Thanks for reading. Ok so i want to work on an EASY basic game. As simple as Guess what number... But there are some twist... Ok So here is my example... (HTML, i know this.)I'm Guessing a number 1-99. What is it? (java) Lets say its 66 and they guess 53, have the text rusult be in a pop up window be: Too low! (java) Lets say they guess 78, have the text rusult be in a pop up window be: Too high! (java) Lets say they guess 100+, have the text rusult be in a pop up window be: Out of range! (java)But lets say they guess 66, have a text result be in a pop up window be: You've won! (java) I want a text field where you can enter your answer, and it will do the actions above. Can anyone code this? Thanks for reading! been searching everywhere for help on this javascript kit but no luck JSE internal seach engine v 1.0a http://www.javascriptkit.com/script/...se/index.shtml Description: JSE is a highly robust, 100% client side search engine for indexing and searching your own site, using JavaScript 1.3. Some of JSE's noteworthy features a * Uses regular expressions to efficiently and rapidly search the index for matches based on the entered keywords. Supports basic logic (ie: negation). * Returns the results on a seperate page from the search form itself, neatly formatted. Uses session cookies to transmit the query between the two pages. * Stores the index (url, keywords and description for each page you wish to be "crawled") in the "results" page. This means the index is loaded only when a search has actually been performed, saving on bandwidth and download time. * Searches title, description and desingated keywords within the index for a match. * Works in IE4+, NS4, and NS6+. its perfectly working on local server but when I uploaded my files to my webserver. it doesn't work. Is there anybody can help me with this? TIA Hi everyone, I have a very simple question. I found some answers on the web but nothing quite concluding. I am hearing Search Engine can only be build with server-side programming or through google (which means your site must be connected to the internet. Is it possible to build a simple yet effective search engine for an in-house site (not connected to the net, only network) with JavaScript? My understanding is that, using arrays, once a user enter a word in a fied, the program would need to index all the pages containing the word. Then the program would need to target each seperate paragraph containing the word. Also what if the results must lead you to a document which must open in an iframe? Possible? How? Cheers I am new to Javascript and I downloaded JSE internal search engine v 1.0a from CodingForums. It works fine in all browsers other than ie6 and ie7. Have confirmed that other javascripts are working in these browsers so it is not my browser settings. Can anyone help?
Hey all, I have the old Yahoo! chess engine and Im making a webpage with a chessboard. Currently everything involved with this chessboard is wrapped up inside the code and dynamically creates everything it needs to operate. I have made a few customizations on several elements such as the PHP dropdown box that it dynamically creates as a quickjump to games. But i am wondering if someone wouldn't mind helping me in finding a way to write an amendment that reads 3 parts of the pgn file (Black)(Result)(White) (which it already does read them but just shows the info in the dropdown box) and display them as a header to the board. Everything in this script as far as variables go, are numbers... which makes it difficult at best which makes visual mapping harder. So I thought I would ask a professional what I should be looking for in the script so that I can go ahead and modify it and reuse some functionality to display a game header from javascript. The pgn viewer will read either string format directly input into the setup configuration in the html page, or it will read from a file. It them parses the elements based on the pgn tags. PHP Code: var tag=this.parseTag("FEN",pgn,i); if(tag&&tag!="?"){ this.board.startFen=tag; }else{ tag=this.parseTag("White",pgn,i); if(tag&&tag!="?"){ _68=tag; }else{ tag=this.parseTag("Black",pgn,i); if(tag&&tag!="?"){ _63=tag; }else{ tag=this.parseTag("Result",pgn,i); if(tag&&tag!="?"){ _62=tag; }else{ tag=this.parseTag("Event",pgn,i); if(tag&&tag!="?"){ _64=tag; }else{ tag=this.parseTag("Site",pgn,i); if(tag&&tag!="?"){ _65=tag; }else{ tag=this.parseTag("Date",pgn,i); if(tag&&tag!="?"){ _66=tag; So the variables I want to use are _68, _63, & _62 and display them as a header to the board. Any help is appreciated. Hey guys, While I know you cannot use javascript for SEO, I need something similar. What I need is something like a search and replace program or something that does this: it takes aspects of the filename and incorparates it into the meta tags. For example, if a file was named "1x9.html" I would want it to edit the meta tag Season 1 Episode 9 I was just wondering if you guys know if such a thing exists. Like I would write a script or something in the program, saying for it to search and replace meta tags in file names, and it would 1. Analyze the filename (for this example it will be "1x9.html" 2. Input " Season 1 Episode 9 " into the meta tags (analyzing the first character in "1x9" as [Season] [First Character] , analyzing the "x" in 1x9 as [Episode] and analyzing the last character in "1x9" as [Last Character] I need to do this for like 80 thousand files, and I cannot do it 1 by 1. All of the elements that need to be in the meta tags already exist in the webpage contents or webpage filename. I was wondering if you guys know the best way for me to go about this? I have been playing with this for a week and think I may need to move on but thought I would try you guys. I need a java script search engine for my site that I can manually enter keywords and direct the results to certain url locations. I thought I found one called JSE Search Engine and it works great in my adobe golive preview but when i upload the files the results dont show up. Very frustrating. Thought maybe someone might be familiar with it or at this point have a script to do what I need that is less of a headache. Thanks in advance for any help.
Some background might better help my actual problem. Feel free to address either with any relevant insights. While attempting to create a greasemonkey script in FF2 (don't ask), I discovered that the "let" statement was causing my code to fail. After confirming that this statement has been available since FF2 (js engine 1.7) https://developer.mozilla.org/en/New_in_JavaScript_1.7, I became curious as one determines their javascript engine in FF. IE has a way to inspect the jscript engine, ala http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx , but I couldn't find anything similar for FF. Feel free to list links for testing engines in other browsers, too. I can't use irc at work, so it's good to know this place is still around for numb-nuts like me. :-) Many, many thanks (in-advance). Say that I've got the following XML Code: <document> <block key="block1"> <p>This is a <bold>paragraph</bold></p> </block> <block key="block2"> <p>Additional paragraph</p> </block> </document> Obviously the schematics of this data and the constraints placed upon them can be described using XSD. For example, the following rules would apply: * must be a document element as the top-level parent element * must be at least one block element as a child of document * each block must have a unique key value * blocks can have 1...n p child elements. * p elements can have 0...n bold child elements What I'm looking for is an engine that executes on the client-side (JavaScript / jQuery) that can parse the XSD and flag any errors. In addition I would also need to be able to interrogate the engine in order to determine what are valid child nodes at a particular level of the XML. For example, the following types of queries might be asked of the engine: * Q: Is the overall XML valid? A: yes / no + report * Q: I'm looking at the element block (key="block2"). What are the valid child elements of this element? A: p (1...n). * Q: I'm looking at the element p in the first block (key="block1"). What are the valid child elements of this element? A: #text, bold (0...n). Determining the valid child elements of a particular element is something akin to how Visual Studio e.g. 2010 uses Intellisense. For example, given a schema Visual Studio let's you know what the valid elements are at a particular position as you type enter the XML. Finally I've mentioned XSD / XML above but we do not necessarily have to be constrained to these technologies so alternative ideas will be appreciated equally as well. Thank you for taking the time to examine my post. How would you create a text field that allows users to select different search engines, and then search their keyword. Essentially what I'm looking for is a something similar to the default multiple search field that you see in Firefox and Safari. At this point in time I have the multiple search feature implemented. But all I really have is a <select> next to a <input>. What I want is something that combines the two. Basically I want the look and feel of Firefox/Safari default multiple search field. Any help would be appreciated. Thanks, Can anyone get me a simple script for a search engine for my website? i cant find a decent 1 anywhere. thanks
Yeah, it's that internal search engine script again. But before you click away, I'd like to ask whether anyone can solve a problem I've come up against... I have minimally changed the script to present results with a clickable url (this is my attempt at creating an image search engine, hence having to use this method). The problem I have suddenly encountered however is that the urls, while they read complete, they only link one directory deep into my website. For example: Reads as: http://www.mysite.com/search/set1/doctor.jpg Link is: http://www.mysite.com/search As you will see, I've omitted using the numbering array and have rearranged the order in which the values for how the search results are called. Code: if (include_num == 1) { document.write(a + 1, '. <a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } else { document.write('<a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } It is with this second point that I fear I have caused the damage. Code: // ---------- script properties ---------- var include_num = 0; var bold = 1; // ---------- sites ---------- var s = new Array(); s[0] = "^this will be added soon/form.html^Click to view image^"; s[0] = "^this will be added soon/doc.txt^Click to view image^"; s[0] = "^http://mysite.net/archive/Gliding/folderthumb.jpg^Click to view image^"; s[0] = "^this will be added soon/doctor.txt^^"; // ---------- end of script properties and sites ---------- var cookies = document.cookie; var p = cookies.indexOf("d="); if (p != -1) { var st = p + 2; var en = cookies.indexOf(";", st); if (en == -1) { en = cookies.length; } var d = cookies.substring(st, en); d = unescape(d); } var od = d; var m = 0; if (d.charAt(0) == '"' && d.charAt(d.length - 1) == '"') { m = 1; } var r = new Array(); var co = 0; if (m == 0) { var woin = new Array(); var w = d.split(" "); for (var a = 0; a < w.length; a++) { woin[a] = 0; if (w[a].charAt(0) == '-') { woin[a] = 1; } } for (var a = 0; a < w.length; a++) { w[a] = w[a].replace(/^\-|^\+/gi, ""); } a = 0; for (var c = 0; c < s.length; c++) { pa = 0; nh = 0; for (var i = 0; i < woin.length; i++) { if (woin[i] == 0) { nh++; var pat = new RegExp(w[i], "i"); var rn = s[c].search(pat); if (rn >= 0) { pa++; } else { pa = 0; } } if (woin[i] == 1) { var pat = new RegExp(w[i], "i"); var rn = s[c].search(pat); if (rn >= 0) { pa = 0; } } } if (pa == nh) { r[a] = s[c]; a++; } } co = a; } if (m == 1) { d = d.replace(/"/gi, ""); var a = 0; var pat = new RegExp(d, "i"); for (var c = 0; c < s.length; c++) { var rn = s[c].search(pat); if (rn >= 0) { r[a] = s[c]; a++; } } co = a; } function return_query() { document.jse_Form.d.value = od; } function num_jse() { document.write(co); } function out_jse() { if (co == 0) { document.write('Your search did not match any images currently on file.<p>Make sure all keywords are spelt correctly.<br>Alternatively, view the Unknown Section of the Archive and help us put a name and date to your memories.'); return; } for (var a = 0; a < r.length; a++) { var os = r[a].split("^"); if (bold == 1 && m == 1) { var br = "<b>" + d + "</b>"; os[2] = os[2].replace(pat, br); } if (include_num == 1) { document.write(a + 1, '. <a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } else { document.write('<a href="', os[0], '">', os[1], '</a><br>', os[2], '<p>'); } } } Because of the nature of the site (it will have over 600 images eventually), my level of understanding and the obviously limitations with this script, I'm looking for a solution that doesn't require a different edit for each entry. So far I have been able to simply drop a block of urls into this script (having planted a .php script to get the image directory listing) and then 'replace all' text that needs to be edited. In short, how do I ensure that the hyperlink for the url that is returned in the search query is full and not truncated to the first directory? ANY help in the matter would be really appreciated. Thank you in advance, Sam Hi guys, i've been the last few days around a script that i can't make it work, i'm a beginner in javascript so if you guys could help me i'd appreciated. This script is a search engine, when you look for something say the word "titanic" , he shows you a list of results with numbers, being the first link with the higher number (kinda like a score), and then after u click the link you want he goes to the respective page. Now i want him to skip the results page, and directly open the first link that he founds on the page. The Script __________________________ <!-- Begin var item = new Array(); // Just enter as many additional pages that you want to search, then fill in he // additional listings for each page. // "Page Name","path","Page Title","Many,Key,Words","Descriptive Comments" c=0; item[c]=new Array("centerif.htm","","titanic","index,main,start,home,front","Demonstration search engine data about an imagined but probable internet site."); c++; item[c]=new Array("indexg.htm","","About Me","about,author,contact,email,who","Contact details and general information about the creator of the site and what the site is about."); c++; item[c]=new Array("links.htm","","Links page","links,more,where,similar,friends","Links to my favourite sites which I find interesting. Other friends sites which have similar interests to my own."); c++; item[c]=new Array("main.htm","main/","Main Page","content,main,focus","The main part of my site which contains what you have come to see. Lots of stuff like that and more great things. All in a sub directory."); c++; item[c]=new Array("logo.jpg","main/images/","Link Logo","link,image,logo,graphic","The logo.jpg is just a small image which you can place on your site as a link to me. It's in a second level subdirectory."); page="<html><head><title>Search Results</title></head><body bgcolor='white'><center><table border=0 cellspacing=10 width=80%>"; function search(frm) { win = window.open("","","scrollbars"); win.document.write(page); txt = frm.srchval.value.split(" "); fnd = new Array(); total=0; for (i = 0; i < item.length; i++) { fnd[i] = 0; order = new Array(0, 4, 2, 3); for (j = 0; j < order.length; j++) for (k = 0; k < txt.length; k++) if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "") fnd[i] += (j+1); } for (i = 0; i < fnd.length; i++) { n = 0; w = -1; for (j = 0;j < fnd.length; j++) if (fnd[j] > n) { n = fnd[j]; w = j; }; if (w > -1) total += show(w, win, n); fnd[w] = 0; } win.document.write("</table><br>Total found: "+total+"<br></body></html>"); win.document.close(); } function show(which,wind,num) { link = item[which][1] + item[which][0]; line = "<tr><td><a href='"+link+"'>"+item[which][2]+"</a> Sco "+num+"<br>"; line += item[which][4] + "<br>"+link+"</td></tr>"; wind.document.write(line); return 1; } // End --> </script> __________________________________________ Once again thanks guys, it's appreciated !! Well, this is only beginning and kinda beta, but this is just awesome! This is 100% secured, but yet unfinished. This is huuuuuge! I've created temporal apache server on my computer to show how it works: http://80.222.127.106/downloads.php hello i'm building a search engine and one of the options i'm implementing is this: the user is able to control the scale of the thumbnail, small, medium and large the problem is that when i have 1000 pictures inside a div when i hit resize i get like a 5 sec delay for them to resize here is the javascript code: Code: Code: var factor; function fillImg(imgPath, imgElement){ imageObj = new Image(32,32); imageObj.src = imgPath; if(imgElement.src != imgPath ){ imgElement.src = imgPath; } } function errHandler(err){ alert("Error occured!"); } function resizeImgList(scale){ if(scale == "s"){ factor = 50; }else if(scale == "m"){ factor = 100; }else{ factor = 150; } var lists = document.getElementById("rs_ls").getElementsByTagName("li"); for(var li_index = 0; li_index < lists.length; li_index++){ var canvas = lists[li_index].getElementsByTagName("span"); for(var c_index = 0; c_index < canvas.length; c_index++){ var link = canvas[c_index].getElementsByTagName("a"); for(var a_index = 0; a_index < link.length; a_index++){ var image = link[a_index].getElementsByTagName("img"); for(var i_index = 0; i_index < image.length; i_index++){ var w = $(image[i_index]).attr("width"); var h = $(image[i_index]).attr("height"); var results = resizeItem(w,h,factor,factor); var w = results[0]; var h = results[1]; var m = results[2]; $(image[i_index]).attr("width",w); $(image[i_index]).attr("height",h); $(image[i_index]).attr("style","width:"+w+"px;height:"+h+"px;"); } wa = w+12; ha = h+12; $(link[a_index]).attr("style","width:"+wa+"px;height:"+ha+"px;"); } wc = w+12; hc = h+12; $(canvas[c_index]).attr("style","width:"+wc+"px;height:"+hc+"px;margin-left:"+m+"px;margin-right:"+m+"px;"); } wli = w + 12 + m * 2; hli = h + 12; $(lists[li_index]).attr("style","width:"+wli+"px;height:"+hli+"px;"); } } function resizeItem(eWidth, eHeight, tWidth, tHeight) { percentage = (tHeight / eHeight); newHeight = parseInt(eHeight * percentage); newWidth = parseInt(eWidth * percentage); if (newWidth > tWidth) { percentage = (tWidth / newWidth); newHeight = parseInt(newHeight * percentage); newWidth = parseInt(newWidth * percentage); } margin = (tWidth - newWidth + 12) / 2; results = [newWidth, newHeight, margin]; return results; } each result set of 50 images has this structu HTML Code: Code: <span> <ul> <li>...</li> <li>...</li> <li>...</li> <li>...</li> . . . <li>...</li> <!-- 50 <li> --> </ul> </span> so 50 results are contained inside a span each <li> has this structure inside: HTML Code: Code: <li> <span> <a href...> <img> </a> </span> </li> I altered the resizeImgList function with 1 for loop but even then it didnt seem to improve. i was thinking that i could resize only the results the user is currently seeing inside the div, the current <span> of results but i'm anaware of how to accomplish this please if anyone has any idea I would be gratefull. Thank you. Peter. PS. results (spans) are fetched via AJAX on scrolldown inside the a div (which is the result container). I have a game page on my site and I am trying to protect direct access to it by .htaccess .htpasswd but is not accepting user name and password? .htaccess: AuthUserFile /home/vhosts/kandcoentertainment.freetzi.com/.htpasswd AuthType Basic AuthName "game1" <Files "cookietest.html"> Require valid-user </Files> .htpasswd test:8888 Any suggestions on why it is not working? What I would like to do is have apay and play once setup but as I am a novice and dont have a clue HELP PLEASE!!! What I have been told is - protect the files, add a client side cookie to game page then upon url payment return validate cookie giving single access and when played the user cannot replay by refresh or just typing in url because cookie expired ? I have tried to write the scripts up with no success. Hi every1! Got a task in university to make a memory game (card matching game). Thats what i've got so far: Code: var selected = 0; var choiceOne; var choiceTwo; var matches = 0; var numOfTries = 0; var interval = 700; var gamePlace = document.getElementById("wrap"); var backcard="img/memoryBg.png"; var timeStart; var timeFinish; var time; function nameEnter(){ var name = prompt("Please enter your name"); if (name != null){ document.title = "Welcome " + name + "!"; } } function game(){ var nOfPairs = document.getElementById("nPairs").value; timeStart = new Date().getTime(); if (nOfPairs==1){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; } if (nOfPairs==2){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards.sort(function shuffle(){ return Math.random() - 0.5;}); } if (nOfPairs==3){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards[4] = 'img/card3.png'; cards[5] = 'img/card3.png'; cards.sort(function shuffle(){ return Math.random() - 0.5;}); } if (nOfPairs==4){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards[4] = 'img/card3.png'; cards[5] = 'img/card3.png'; cards[6] = 'img/card4.png'; cards[7] = 'img/card4.png'; cards.sort(function shuffle(){ return Math.random() - 0.5;}); } if (nOfPairs==5){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards[4] = 'img/card3.png'; cards[5] = 'img/card3.png'; cards[6] = 'img/card4.png'; cards[7] = 'img/card4.png'; cards[8] = 'img/card5.png'; cards[9] = 'img/card5.png'; cards.sort(function shuffle(){ return Math.random() - 0.5;}); } if (nOfPairs==6){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards[4] = 'img/card3.png'; cards[5] = 'img/card3.png'; cards[6] = 'img/card4.png'; cards[7] = 'img/card4.png'; cards[8] = 'img/card5.png'; cards[9] = 'img/card5.png'; cards[10] = 'img/card6.png'; cards[11] = 'img/card6.png'; cards.sort(function shuffle() { return Math.random() - 0.5;}); } if (nOfPairs==7){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards[4] = 'img/card3.png'; cards[5] = 'img/card3.png'; cards[6] = 'img/card4.png'; cards[7] = 'img/card4.png'; cards[8] = 'img/card5.png'; cards[9] = 'img/card5.png'; cards[10] = 'img/card6.png'; cards[11] = 'img/card6.png'; cards[12] = 'img/card7.png'; cards[13] = 'img/card7.png'; cards.sort(function shuffle(){ return Math.random() - 0.5;}); } if (nOfPairs==8){ var cards=[]; cards[0] = 'img/card1.png'; cards[1] = 'img/card1.png'; cards[2] = 'img/card2.png'; cards[3] = 'img/card2.png'; cards[4] = 'img/card3.png'; cards[5] = 'img/card3.png'; cards[6] = 'img/card4.png'; cards[7] = 'img/card4.png'; cards[8] = 'img/card5.png'; cards[9] = 'img/card5.png'; cards[10] = 'img/card6.png'; cards[11] = 'img/card6.png'; cards[12] = 'img/card7.png'; cards[13] = 'img/card7.png'; cards[14] = 'img/card8.png'; cards[15] = 'img/card8.png'; cards.sort(function shuffle(){ return Math.random() - 0.5;}); } if(nOfPairs>8||nOfPairs<1){ alert("Please enter the number from 1 to 8"); }else{ for(i = 0; i<=nOfPairs*2-1; i++){ var cardDiv = document.createElement("div"); cardDiv.setAttribute("id",""+i+""); cardDiv.style.height="65px"; cardDiv.style.width="65px"; cardDiv.style.float='left'; gamePlace.appendChild(cardDiv); document.getElementById(""+i+"").innerHTML='<img src="img/memoryBg.png">'; cardDiv.onclick=function(){cardClick(this.id);}; } } function cardClick(card){ if (selected==2){ return ; } if (selected==0){ choiceOne=card; document.images[card].src = cards[card]; selected = 1; }else { selected = 2; choiceTwo = card; document.images[card].src =cards[card]; var timer=setInterval(checking,interval); } function checking() { clearInterval(timer); numOfTries++; document.getElementById("tries").innerHTML = numOfTries; if (cards[choiceTwo]==cards[choiceOne]){ matches++; document.images[choiceOne].src = "img/memoryBgI.png"; document.images[choiceTwo].src = "img/memoryBgI.png"; //choiceTwo.onclick=null; } else { document.images[choiceOne].src = "img/memoryBg.png"; document.images[choiceTwo].src = "img/memoryBg.png"; selected = 0; return ; } if (matches == nOfPairs){ timeFinish = new Date().getTime(); time = Math.round (((timeFinish - timeStart)/1000)); alert("Congrats! You needed " + numOfTries + " tries, and " + time + " seconds."); } selected = 0; return ; } } } so the problem is, that I can just click 2 times on one card and it will look like a coincidence. My second problem is that when I have a real coincidence, I can still click on that card (by "real coincidence" i mean two same pics. so when i find them, they have to be not active, and when im clicking on them, they should just simply do nothing.). Can someone help me? Hello, I am trying to create a clock for my video game. I need to begin the clock at zero and count while the game is going. I need to have the clock count in standard minutes and seconds but not be based on the actual time of day. I am coding in javascript for an applet.
Hello everyone. I have a tic tac toe game I am working on and I managed to make it so you can place X's and O's respectively. My next problem is making a win condition so it checks to see if the X's won the game or the O's did. Here is what I have so far. Edit fiddle - JSFiddle What I am basically thinking is that when you are clicking I want whatever letter it is that is placed to be saved and then I can check to see if all 3 are equal to that letter. It is a bit hard to explain. Essentially I want to make a win condition. If anyone could throw some assistance my way that would be great. I know for sure it requires a lot of checks because there are so many different ways of winning, I just need to know that initial one. Thank you very much. |