Cheat function and Copying Pictures?
Author |
Message |
tristanbryce7
|
Posted: Tue Dec 04, 2012 4:28 pm Post subject: Cheat function and Copying Pictures? |
|
|
Hello, I had two questions, one was,
what specifically is the "cheat" function and why is it supposedly "Dangerous"
and my second one is
say that I had a picture in 8-bit form, is there any way to get Turing to copy that photo on the "output" window, and have turing write the selected code for the picture as well? I know it can be done cuz my friend did it, he just didn't tell me how, so how would I get a picture in 8-bit form to copy onto Turing output window and get Turing to create the code for it(like drawfillbox's and etc) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Tue Dec 04, 2012 4:48 pm Post subject: RE:Cheat function and Copying Pictures? |
|
|
'Cheat' lets you use one data type as if it were another. A computer really doesn't care what type a piece of memory is supposed to be. It's all just ones and zeroes. So if you have an integer (let's call it i), and you set it to 65. If you do something like 'put cheat (char, i)', it will read i like a character and output it to the screen. Instead of showing '65', it will show 'A'. If you have a char (we'll call it C) set to 'A' and run 'put cheat (int, C)', it will output 65. Then again, it might output some other int entirely if you've got a funky CPU. I've never tried this, but you could probably even do something like "put cheat (array 1..5 of int, C)[1]. I have no idea what that would do. You're treating a char as an array of 5 ints. It probably would read the 5 bytes in RAM beginning at C's location, but I dunno how out-of-bounds errors would be treated.
There are commands available in Turing to draw images (look up 'Pic' in the documentation). There is a command to look up the pixel color at any point on the screen. There are commands for writing text to a file. With those three things, you can get Turing to write the Turing code to draw that image. It's very basic to write a program that writes a program that draws pictures using only Draw.Dot(), but with extra effort you can have it use Draw.FillBox(), etc. |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 4:57 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
Thanks a lot man!
And if its not too much, Could you tell me the specific Pic Modules that allow you to draw it ? As there are a lot, and Turings documentation and syntax is kind of confusing for me sometimes :/ |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 5:00 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
And if possible, could you also tell me a bit on how you would get turing to write the code for it ? |
|
|
|
|
|
Insectoid
|
Posted: Tue Dec 04, 2012 5:01 pm Post subject: RE:Cheat function and Copying Pictures? |
|
|
Learning how to read docs is an important part of computer science. You'd better get to it! It's pretty obvious which one you need, but you'll want to look up Pic.FileNew() on top of that since it isn't shown in the example. If you're still having trouble, check the Turing Walkthrough. |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 5:04 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
I am honestly so confused lol , I tried getting a program to write the code for a pciture but I had no luck,
I think I know two of the three functions you are talking of
the one to import the picture is Pic.Draw, Pic.FileNew, and the one to locate the pixel color is
View.WhatDotColor (Correct?)
and for the one that writes data to a file I am absolutley lost, I have no clue how to put these three together in a program, let alone use them on their own (except Pic.Draw/FileNew)
I am pretty much a beginner at Programming , not that good :/
Please tell me if you can |
|
|
|
|
|
Insectoid
|
Posted: Tue Dec 04, 2012 8:12 pm Post subject: RE:Cheat function and Copying Pictures? |
|
|
Once again, check the Turing Walkthrough. File I/O is in there.
There's nothing difficult about this program. Just break it up into smaller parts, and then break those parts up into smaller parts. That's how you should be approaching every program (and indeed, every problem in general). There are no tricks or secrets to this one; it's very straight-forward. One thing at a time. |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 8:47 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
Could you give me a few more pointers on it ? I ve been ttrying to figure it out all day lool , Input Output, but my knowledge of comp prog. is very limited , so im pretty much lost lol.
Was i atealst right about the View.WhatDotColor thing ?
Do i have to use the "open" module????
Please, I just want to get it solved :/ |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Tue Dec 04, 2012 9:06 pm Post subject: RE:Cheat function and Copying Pictures? |
|
|
Quote: Please, I just want to get it solved :/
I'm sure you do, but you're going to have to do the work to get there.
Quote: Was i atealst right about the View.WhatDotColor thing ?
Why don't you fool around with it to see what it does and how it works, and then decide for yourself?
Quote: Do i have to use the "open" module????
Do you know what the 'open' module is? Do you know how to use it? If you do, then you'll know whether or not you should be using it. If you don't, then you should probably start figuring it out.
Once again, the Turing Walkthrough is your friend. Read it. It has some very good tutorials. It even has a whatdotcolor tutorial (View.WhatDotColor and whatdotcolor are pretty much the same thing). If you read it, you will understand it. If you don't read it, you will not. If you still don't understand it after you have read it, there are a at least a dozen other tutorials in the tutorial section. See the 'Search' button at the top of the page? Use it.
Computer science is about solving your own problems. If you can't do that, you will never be a very good programmer. If you can't solve this problem, maybe you should start with something easier and work your way up. Start with a program that draws a picture. Then write a program that writes text to a file. Then write a program that reads pixel data from a picture drawn to the screen and does something with it. If you can write all of those programs, then you can write this program. If you can't write all of those programs, you will not be able to write this one. |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 9:12 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
Interesting hmm, I know a bit on how to use the open module , I learned a bit, i can read the data from a turing file using open, but thats it |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 9:14 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
and by the way, when you mean : A program that can write text to a file, what does that specifically mean? Like what type of text, and which file? and Ik how to draw a picture, but not about the pixel data, I usally use the Turing Docuemntaion for help |
|
|
|
|
|
Insectoid
|
Posted: Tue Dec 04, 2012 9:16 pm Post subject: RE:Cheat function and Copying Pictures? |
|
|
If you would read the tutorial in the Turing Walkthrough, you would see that the very first example of the 'open' command is of writing data to a file. Have you actually looked at it yet? If you don't demonstrate in your next post that you have made an attempt to read it (Key word: Demonstrate. Don't just tell me you did. Show me you did), I will not help you. |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 9:21 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
Finnee, theres never an easy way out . So you suggest reading these sections?
File Input/Output - Reading and writing data from/to text files by Freakman
Pictures - Import your own .bmp's and .jpg's by Hacker Dan
Whatdotcolour - Another approach to collision detection and other useful things by Andy
Those are the 3 that I am going to read, are there any other tutorials that you may suggest for me that I should read to reach my current objective? |
|
|
|
|
|
tristanbryce7
|
Posted: Tue Dec 04, 2012 10:24 pm Post subject: Re: Cheat function and Copying Pictures? |
|
|
Almost got it! Thanks Just now need a way to get all possible x,y co-ordinates |
|
|
|
|
|
mirhagk
|
Posted: Wed Dec 05, 2012 9:10 am Post subject: RE:Cheat function and Copying Pictures? |
|
|
just think about how many different x values there are, and how many different y values there are. With that you can get the range for x and y, and then you can simply iterate over all the points. |
|
|
|
|
|
|
|