| Furball - Oct-10-2004 server time |
| Nice |
| Red Squirrel - Oct-10-2004 server time |
| Hahaha, I made something like that, it looked like a typical ms dos session when you first open cmd.exe, but when you hit a key, it typed a character, to eventually type deltree /y *.* then after a few more keys it would "press enter" and simulate the deletation of all the files. |
| Furball - Oct-10-2004 server time |
| LOL. That reminds me of something else. One of my classmates made a program that wrote different words whenever you typed. It accepted user input, but everytime you typed, it would spell different words. Man, that would make a good April fool's joke to play on somebody who is computer illiterate |
| Red Squirrel - Oct-10-2004 server time | ||
| haha this made me think of a cool php script to write. Basically a form with the variable "thesis" and a submit button, pointing to this script:
Let's assume that the function RandThesoraus() takes a phrase and randomly rewrites it using different words. With this simple script, you can make nice recursive blabbing essays. |
| Furball - Oct-10-2004 server time |
| Ever have to write a 5 page essay on recursion in Java? It's not as easy as you'd think. Mostly it's "recursive babble". Hehe, partial PUN going on there |
| Furball - Oct-10-2004 server time |
| There are just soooooo many ways to solve the first problem. As for the third, RECURSION. Let's NOT go there |
| Furball - Oct-10-2004 server time |
| For the first problem, you have to use a function that calculates exactly HOW many letters are being used. So if you were to type in ABBCCBBA, it has to count the 8 letters. Now, if you think about it, if you were to divide the number of letters in 2, and the total amounts of letters were even, then that first half is the same as the last half, only the last half is backwards. So, what you would have to do is take the total amount of letters (which is 8) and compare. You need a counted loop to compare for ALL the letters in the word divided by 2 (So in the above case, the loop will go through 4 times). Now, each letter has to be compared to the one in sequence. So, the first letter has to be compared with the last, so that it matches. If it doesn;t match, you might as well just exit the loop right there (No bother doing ithe rest if the first 2 don't match). The way i'd do it is to set 2 variables; One as X and one as Y (I chose X and Y because they are just the most common variables I USE.) X would start with the value of the first letter (So it's the FIRST letter, so it's value is 1). Y would be the last letter (So it's value is 8). Now, each time the counted loop goes through, The CHAR value (Letter) for X and Y are compared. If the letters match, the loop goes on, and if they don't, the loop ends and displays that the word ISN'T a palindrome. Now, each time the loop goes through, the X value INCREASES 1, and the Y value DECREASES 1 (so that the next letters can be compared). Now, if you keep doing that for the complete length of the loop (4 times), and each time, the word was compared SUCCESSFULLY, have it display a message that the word is a palindrome. The above method ONLY WORKS for words with EVEN numbers. For Odd number palindromes like ABCBA, find the middle letter © and just remove it, creating the word ABBA instead (You'll probably need a function for this). The middle letter in an odd numbered palindrome is useless, so if you get rid of it, and use the same method as the even numbered method, it works out just the same. There, that's how I WOULD SOLVE this problem. That's the first solution that comes to mind. I didn't explain the functions of breaking down strings from letters to ASCII values because that would have taken too long, and I assume that people would know that. Darn, this problem kind of makes me want to make it myself just for the fun of it (But I will resist) |
| FaZoNiCa - May-04-2004 server time |
| We're learning Turing in school, but I don't think we've gotten far enough to figure that out...sorry!! I could POSSIBLY help with the second one, but I'm not sure I totally understand what is being asked? |
| Electric Ant - Apr-15-2004 server time | ||
I don't know any Turing but could help you structure the code if that will help at all?? EG: In VB which is the most intuitive code I know, the first question could be answered using something like th following....... 'function returns the variable answer Function pallindrome(answer) 'declare your parameters Dim lengthofword As Integer Dim lengthofhalfofword As Integer Dim testcharacter1 As String Dim testcharacter2 As String Dim wordtotest As String Dim i As Integer 'counter for loop Dim answer As Boolean 'get user to enter word to be tested wordtotest = InputBox("enter word to test") ' find out how long word is lengthofword = Len(wordtotest) 'divide string in half and round to nearest integer lengthofhalfofword = CInt(lenthofword / 2) 'assume word is a pallindrome answer = True 'start loop to test each half af the string to see if true i = 1 For i = 1 To lengthofhalfofword 'set testcharacter1 equal to character in ith position from left of text testcharacter1 = Mid(wordtotest, i, 1) 'set testcharacter2 equal to character in ith position from right of text testcharacter2 = Mid(wordtotest, lengthofword - i - 1, 1) ' if they aren't equal then not a pallidrome If Not testcharacter1 = testcharacter2 Then answer = False 'loop until you've tested each half of the text string Next i End Function |
| BatMan - Apr-15-2004 server time |
| But if anyone can help i'll still appriate it. |
| BatMan - Apr-15-2004 server time |
| Alright thanks. |
| syb - Apr-14-2004 server time |
| aye i forgot all mine sorry. |
| Red Squirrel - Apr-14-2004 server time |
| Welcome to the forums! Not allot of us know turing so you might have better luck in a turing specific forum for turing needs. |
| BatMan - Apr-14-2004 server time |
| Hello, i'm in need of some help. I have 3 questions in school that i dunno how to do using Turing. I was wondering if i could get some help or just the answers. Well here are the questions. Write and test a function called palindrome that tests whether or not its parameter is a palindrome, a word spelled the same forward and backward. The function should return true or false. Submit the function and the test program in one file. (5 marks) (APP) Write and test a subprogram that will take an array of names and remove all duplicates. Read the list of names from a file. The first line of the file contains the number of names in the file. Submit the procedure and the test program in one file. (5 mark) (APP) Write a recursive function called power that when called as power (x, n) will produce the value xn, where x is a real number and n is an integer. Use the recurrence relation xn = xn – 1 * x and x0 = 1. Test your function by writing a main program that asks the user for the base and the exponent. Make sure you bullet-proof your program. Submit the function and the test program in one file. (5 mark) (TIPS) Sorry this must be overwhelming, any help is well appriated. Thanks. |