Remove String From My Rock - Paper Scissor Java Game?
Oct 18, 2011
First of all, I wanna make my code using (while loop, do while loop, int, double, if, else, else if, Math.random, Scanner-- not string or boolean).
-Actually the game goes like, after the user and the computer has has selections it is gonna be displayed and then tell who wins and who does not--I dont know how to do it.
- When user presses 4, the the computer tells wins, loses and ties. This happens to me after two tries, wheteher i press 4 or not.(actully its |y/n| in mine and i want to change it to just 4 to quit).
-The user is only allowed numbers from 1 to 4, but apparently, i add any number and it works.
-My code gos like this:
View 2 Replies
ADVERTISEMENT
Apr 4, 2009
I am having a very hard time with this game. i can get the userChoice image to display, and the computerChoice image to display, but i cannot get the checkWinLoseTie() function to work. but i am unsure WHY it isnt working. are my arguments wrong (i know there is something wrong, but cannot get it right!), are the variables even getting assigned a value?
I keep getting the message "you lost" which means that the rest of the stuff is not running!
Here is my code:
This is my other code (ive been trying to get either or to work! cant figure out which one woudl be best)
View 1 Replies
View Related
May 8, 2011
I'm writing a JavaScript application that would prompt the user for a number between 0 and 2, generate a random number for the computer, then take that input and display two images (in this case two hands making rock, paper, or scissor symbols at each other) using an array, and displaying text indicating a win, draw, or loss. I'm having a lot of problems getting this to work as I am new to JavaScript and am wondering if anyone could help me fix this problem. I just want the input from the prompt AND the random number to translate to what in the array should be displayed and what text is then shown at the bottom.
[Code]..
View 3 Replies
View Related
Apr 24, 2010
I have written a game of rock, paper, scissors. There are two things I would like to do here:
1. Make the playagain function work. I would like to have a variable start out as 'y', then be redefined as either 'y' or 'n' when the prompt occurs. If this is not possible, any other way to make this work would be welcome.
2. Use <div> tags and CSS to make .swf's appear and disappear accordingly.
EX: I say scissors, Computer says paper. An swf is played of scissors beating paper. When the anim is over, it disappears, and the game continues.
The Code:
Code:
View 3 Replies
View Related
Dec 5, 2011
I have an assignment to code a java class that plays rock, paper, or scissors. The class can access the history of past gestures played by both itself and its opponent, but nothing else. The class will be played against others in 10,000 matches and the winner will be determined via round robin format. Other than using a greedy algorithm to determine statistically the best choice from prior gestures and basic pattern recognition I have no decent ideas.
View 6 Replies
View Related
Apr 12, 2011
I have been working on a "Rock Paper Scissors" game to see if I understand the basics of JavaScript. It all works well until I get to the if statement from lines 30 to 71 in the `fight()`: I have adjusted the reply variable to indicate how it may be "if'ing" through. It seems to be returning the default value of every sub "if" in the overall "if". Am I using the wrong variable for the secondary condition maybe?
Code HTML4Strict:
View 1 Replies
View Related
Jan 20, 2009
Ideas on Java script Tile base game engine. You know.. with click to walk (or keyboard), inventory, grab items, talk to people, exp, levels, etc.
View 1 Replies
View Related
Jul 23, 2005
I encoded the action = of my form using GET and I can't seem
to get the property/value stuff from it using a JavaScript script I got from
the web.
I want to create a trivia game where the user gets 1 question at a time and
it keeps scoring until the end and gives a summary and I want to do it only
in JavaScript (no ASP, PHP, JSP, etc).
I tried submitting the quiz page to itself using a query string to keep
track of question # but no joy.
I can post code if necessary or is there a trivia game engine made for 1
question at a time instead of all on 1 page?
Anyway, I looked on Google at the query string issue til I'm sick of it. I
found a Beatles trivia game but it was using frames and hidden JavaScript
source files and that's too much work to try and figure out all of that.
Code:
View 2 Replies
View Related
Jul 12, 2001
Can someone help me with the converting the values to string by using the 'toString'. in java script.
View 8 Replies
View Related
Feb 5, 2011
When using jEditable to update my database and the information is send back the result is an piece of text with an small image. This is the code that writes the result back to my page:
[Code]...
View 1 Replies
View Related
Sep 3, 2009
Is it possible to convert "xyz123456xyz789" into "123456xyz789"? What I'm trying to say is, remove the first occurence of "xyz" from the string, so that all the other occurrences of "xyz" that aren't the first one, remain.
View 2 Replies
View Related
Sep 30, 2011
So say if my string was..
a = "Hello";
alert(a);
How do I get it to say;
alert("ello");
So how do I take off the 'H' in this example..
View 1 Replies
View Related
Aug 9, 2009
i have a string that is having delimiters.
for example like 'aa**bb**cc**dd**ee'
and i want to remove 'bb' from this string and make the string as
'aa**cc**dd**ee'
How can i do this?
View 1 Replies
View Related
Jul 13, 2010
I need to remove a underscore(_) from a string, I am using the replace function bt it does not get removed? Does anybody know why.
here is the code
Code:
ISSUE_support = "Joe_Smith";
ISSUE_support.replace("_"," ");
View 7 Replies
View Related
Jul 23, 2005
How can i remove a string from an existing string in javascript. I have a textbox in a form and want to make sure that when the user clicks a button that certain words are moved, like all instances of "hello" should be taken out of the text the user typed in the textbox.
View 3 Replies
View Related
Jul 1, 2010
I am trying to split out a string. E.G "Australia - VIC". I want to remove everything before the -. The line of code I am using to do this is: var state = optionText.replace(/.* - /,""); This works in IE7, but in all other browsers is only removing the - resulting in "Australia VIC" rather than the desired "VIC"
View 1 Replies
View Related
Feb 28, 2011
How would i use JS to remove " and ' characters from a string?
View 4 Replies
View Related
Jul 7, 2011
I want to remove all symbols of an input string, so I have this javascript command:
Code:
this.value=this.value.replace(/[,.s;/\:{}[]<>?`~!@#$%^&*()_+-=]/g,"");
But, this command removes also the numbers. How can I keep the numbers but remove the symbols?
View 5 Replies
View Related
Jul 8, 2010
I'm trying to remove one of the $ signs from this string below. I've gotten as far as removing them both. I'm having trouble removing one of them.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code].....
View 2 Replies
View Related
Feb 10, 2010
I have function code...
I want to remove all parameters, but first. I don't know what's wrong .
View 2 Replies
View Related
Sep 7, 2009
how to add,modify or remove attribute from a json string?
View 2 Replies
View Related
Nov 16, 2011
I'm trying to figure out how I replaces/removes parts of text in string in realtime using jQuery. This is what I got now:
PHP Code:
$str = 'This is a <b>test</b>. Its not going well!';
echo '<div class="element">';
echo '<span>'.$str.'</span>';
echo '</div>';
echo '<p>Remove</p>';
Code JavaScript:
$('p').click(function() {
$('.element span').each(function() {
var test = array('<b>','</b>','well');
//var test = 'not';
console.log($(this).text());
var text = $(this).text().replace(test, '');
$(this).text(text);
});
});
The problem: As above nothing happens. If I use the var test = 'not'; instead of the array part it works except it also removes the <b> tags? How do I get the array part to work and why is it removing htmltags when executed?
View 2 Replies
View Related
Jul 8, 2010
I'm trying to remove one of the $ signs from this string below.I've gotten as far as removing them both. I'm having trouble removing one of them.[code]
View 3 Replies
View Related
May 18, 2009
i need to write a function to remove consecutive slashses from a string
[Code]....
View 3 Replies
View Related
Jul 8, 2010
I'm trying to remove one of the $ signs from this string below. I've gotten as far as removing them both. I'm having trouble removing one of them.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
[code].....
View 4 Replies
View Related
Aug 30, 2009
If this issue is a JavaScript syntax issue, then I just know you'll spot it.
Context: swfObject2 dynamic embedding.. so the swf object is not written into the code that's sent to the browser. (The swf is there on the resulting page in the browser; doing it's thang just dandy and waiting for further instruction from user action). Function in swf "functInSWF" registered using ExternalInterface.callback(); (I'm working in AS2).
So... javascript:
Code:
The message I'm getting in the debugger is: "TypeError: Result of expression 'thisMovie("someSWF").functInSWF' [undefined] is not a function"... so I'm presuming nothing is being sent to the swf and therefore this is a JavaScript issue I need to track down.
I've tried (what's not recommended) getElementById with the same result.
View 1 Replies
View Related