How to prevent a program on TI-84 from being transferred to another calculator? - ti-basic

I am trying to allow others to use my programs, but I don't want those users to be sharing the programs without my permission, so my goal is to prevent the users from doing this on the TI-84 calculator, but I have had no apparent luck.
For the TI-84 calculator, I have tried the getkey command and the stop. I have tried conditional statements with for and while loops, but I can't seem to prevent the user from sharing the code.
Prompt V
V+2 -> C
Disp C
The code works like it is intended but I can't prevent people from transferring this code to other calculators.

There is no way to prevent people from transferring programs over the calculator. What you could try to do is make it so that after you transfer the program yourself you store a password into a variable that they are unlikely to use (done manually, make sure to clear afterwards). When the program runs it checks if the variable stores the correct value. If someone else transfers the program and doesn't load the password into the correct variable, then the program won't work. However, they can figure this out by simply reading the code. If you want to be extra tricky, you can create a simple hashing algorithm and read from multiple variables. For instance, storing 123 in Z could be hashed by *28 + 54 mod 71 to get to 19. Apply those math functions to the chosen variables and then compare to their hashed value. This protects people from figuring out the password by checking the program (since 19 cannot be reversed to 123). Of course, they can just delete the check, so try to hide it somewhere among junk code. Now, they might overwrite those variables where your password is stored (often by running other programs that use those variables). Simply tell them that they have to come back to you so you can "fix" their program. Hope this helps.

Related

Windows batch card game not working properly, don't know how to fix

So for our computer science class, we had to write a program that randomly generates cards, i decided to do mine in batch, because im a massive noob XD
I was confident that i could do it as im quite experienced with it. Even though batch isn't by any means a good 'language' if your going to call it that. I was able to fix most of the problems by myself with some hard work. I am however, still having some issues i don't know how to resolve.
My biggest issues i don't know how to fix are...
Text not being displayed properly.
Numbers (i use for the base of the AI and card generation) sometimes not being defined properly in variables.
The point system just refuses to work not matter what i do.
It sometimes randomly just flat out decides to crash on me if i skip a 'TIMEOUT' or a 'PAUSE'.
Some 'IF' statements not being executed properly even though there exactly the same as the other ones.
I'm sorry if this question is too broad, but i really didn't know quite how to summarize it.
Here is a link to my card game: http://pastebin.com/t2S3yWk5
Here is our question:
1) Create a program that will generate two random numbers - one that maps to a suit (hearts,diamonds, clubs or spades) and one that maps to a card (Ace, 2, 3, ..... Jack, Queen, King)
*Mine is slightly different, it generates two different suits based on two random numbers.*
2) Create a program that will generate a random card and then ask the user to go Higher,Lower or Quit. If the player chooses Higher the next card must be of a higher value or theplayer is out. Likewise for Lower.
3)Extending the previous program, the user will select a trump suit at the start of the game. If the card is a trump suit card then the game continues regardless of the card’s value. The program will keep score and will save the score to a highscore file. The user will also be able to display the current highscore file.
I would like to try and do this stuff (listed above) myself. I just need help trying to fix my existing program.
I hope that if your reading this you could give me some advise or provide solutions to some of my problems. Thanks in advance! :3
Good news; nothing is super wrong with your code, it's just a bunch of little things that seem like a lot. Some off-by-one errors and a missing variable that I can only assume got replicated from copying and pasting.
Text not being displayed properly
I assume this is the "Access denied" errors that your code produces instead of the AI's comments. This is due to the fact that > and < are used for output redirection, so the emoticons you are adding are trying to create a file in a place you don't have access to. Either get rid of them (recommended) or use ^ to escape them (^>:)).
Numbers (I use for the base of the AI and card generation) sometimes not being defined properly in variables
%random% %% 5 results in one of the numbers in the set 0, 1, 2, 3, 4. You currently do not have an if statement for what should happen if 0 is randomly selected. Add an if statement or have the code go back to the top of the section if a 0 is selected.
The point system just refuses to work no matter what I do
You're going to kick yourself...
Your set statements are missing the assignment portion. SET /A %p1p% + 2 should be SET /A p1p=%p1p% + 2 and so forth (or set /a p1p+=2 if you think that looks better).
If sometimes randomly just flat out decides to crash on me if I skip a 'TIMEOUT' or 'PAUSE'
I couldn't replicate that, but the code seemed to work fine when I removed those statements.
Some 'IF' statements not being executed properly even though they're exactly the same as the other ones
Your comment indicated lines 119-132, which include the if statements that assign points. See above for why those aren't working.
Some other recommendations for your code
Your variable names should be more descriptive. For example, ctog doesn't tell me anything about what that variable should be; I can look at the code to see what it does, but without any context, that could be doing anything.
You should add the /i flag to the if statements that check which card you put down so that C1 and c1 get treated the same. On a related note, you should add a check for when the player enters something other than C1 or C2. You can even use a choice command like you did earlier.
:pvic is missing an exit command, so you automatically play again if you win. Combined with the fact that you only check if lt is equal to 2, not greater than or equal to 2, there's no way to stop playing if you win. Also on the subject of end game conditions, there's no if statement for if you tie the computer.
cp1 and num1 are effectively the same variable, there's no reason to have both (same with cp2/num2, ap1/num3, and ap2/num4).
You need some kind of goto at the end of :pc1 so that :pc2 doesn't automatically run after :pc1 finishes.

Does shell affects the randomization produced by a seed

I am an avid csh/tcsh user.
But the current environment I have to work on has all ksh scripts. The team works on k-shell.
So, if I select a seed and run a test in k-shell and c-shell, would the outcome be the same?
Seed is just one example, I want to know whether using alternate shell would create any divergence of end result?
The whole point of a seeding mechanism for random number generators is to be able to reproduce results regardless of other factors. This means that as long as you're running the same compiled code for the simulator (same version, basically) you're going to get the same results when passing in a seed, regardless of what machine you're running on, what shell you use, etc.
Also, the shell you use has no end effect on the executable being started, other than setting environment variables that the program might use. You're going to have to make sure that you don't diverge in this point.

Is there a command that clears the Y-variables?

I have a command that essentially functions like clearing the memory, but doesn't wipe programs and sets the settings I like. I found out that while it does its job well, it doesn't seem to clear the equations in the Y= menu. Is there a command or another way to achieve this?
PROGRAM:CLEAR
:MATHPRINT
:Normal
...
:DiagnosticOn
:ClrDraw
:Clear Entries
:ClrAllLists
:SetUpEditor
:ClrHome
:"
On a similar note to TimTech, Delvar can be used to reset the value of a variable.
DelVar Y1
The benefit of this is that multiple DelVar calls can be chained without a line break.
DelVar Y1DelVar Y2Disp "Done
A non-programmatic way of clearing a calculator is to use the key sequence 2nd + 7 1 2. Unfortunately, this also clears programs.
This method will clear all RAM on the calculator, so use it with caution.
I found a better programmatic way of clearing the Y-VARS. This method also resets all other graph settings to their default value. In your case, this seems to be a desirable side-effect. Unfortunately, it requires a little bit of set up and occupies one of the Graph Database variables (119 Bytes). Because this variable can be kept archived, this does not consume any RAM.
Setup
Manually clear All Y-VARS, including parametric, polar and sequence variables.
Manually Reset All graph window settings to their default
ZStandard
RectGC
CoordOn
GridOff
AxesOn
LabelOff
ExprOn
Store current setting in a Graph Database variable
StoreGDB GDB1 entered with key strokes: 2ndPRGM◄5VARS3ENTERENTER
Archive GDB1
Archive GDB1 entered with keystrokes: 2nd+5VARS3ENTERENTER
Use in Program
To use this archived variable in a program, you must unarchive it, recall its contents, and finally archive the variable again. This is accomplished by the following code block.
UnArchive GDB1
RecallGDB GDB1
Archive GDB1
If you're using a TI-83 calculator, you need to skip the steps involving archiving because the TI-83 does not support flash memory. The TI-83 Plus and above work fine, however.
No command, but you can do "->Y1 or DelVar Y1 to clear Y1, and similarly for the others.

Is it possible to create a file that cannot be copied?

To restrict the scope, let assume we are in Windows world only.
Also assume we don't want to play with permission policy.
Is it possible for us to create a file that cannot be copied?
Thank you in advance.
"Trying to make digital files uncopyable is like trying to make water not wet." ~ Bruce Schneier
No. You can't create a file that a SYSADMIN can't copy. You could encrypt it, though.
Well, how about creating a file that uses up more than 50% of the total space on that machine and that is not compressible?
For instance, let us assume that you want to save a boolean (true or false) in such a fashion.
Depending on its value, you could then write a bit stream of ones or zeroes and encrypt said stream using some kind of encryption algorith, such as AES in CBC mode. This gives you the added advantage of error correction. Even in case of massive data corruption, you should be able to recover your boolean by checking whether ones or zeroes are prevalent in the decrypted stream.
In that case you cannot copy it around (completely) on the machine...
Of course, any type of external memory that can be added to the system would pose a problem in this scenario. But the file would be already encrypted, so don't worry about it too much...
Any file that can be read can have its contents written to another location (such as another file, i.e. copied).
The only thing you can do is limit who/what can read the file.
What is the motivation behind? If it is a read-only file, you can have it as embedded resources within your assembly.
Nice try, RIAA.
But seriously, no you can not. It is always possible to copy, you can just make it it more difficult for people to make sense of the file or try to hide it using like encryption. Spotify does it.
If you really try hard thou, you cold make a root-kit for windows and use it to prevent windows from even knowing about the file and also prevent copies. The file will still be there and copy-able by other tools, or Linux accessing the ntfs.
If in a running process you open a file and hold an exclusive lock, then other processes cannot read the file until you close the handle or your process terminates. However, as admin you could forcibly remove the lock handle.
Short answer: No.
You can, of course, use security settings to limit who can read the file. But if someone can read it, then they can copy it. Even if you found some operating system trick to disable "ordinary" copying, if someone can read the file, they can extract the contents, store it in memory, and then write it somewhere else.
You can encrypt the contents so it's only useful to your own program, that knows how to decrypt it.
That's about it.
When using Windows 7 to copy some files from a hard drive, certain files popped up a message saying they could not be copied in their entirety; certain data would be omitted from the copy. I suspect that had something to do with slack space at the end of the files, though I thought the message was curious. I would have expected the copy operation to just ignore the slack space.
If you are running old (OLD) versions of windows, there are certain characters you can put in the filename that make it invalid, not listed in folders, etc. They were used a lot in the old pub ftp days of filesharing ;)
In the old DOS days, you used to be able to flag disk sectors as bad and still read from them. This meant the OS ignored the sector in question but your application would know where to look and be able to get the data. Not sure this would work these days.
Another old MS-DOS trick was to put a space character in the middle of the filename (yes, spaces were valid characters for filenames). Since there was no method on the command line to escape a space, the file couldn't be copied using the DOS commands.
This answer is outside Windows so yeah
Dont know if its already been said but what about a file that is an inseperable part of the firmware so that it is always on AND running, perhaps it has firmware that generates a sequence that is required for the other . AN incedental effect of its running is to prevent any 80% or more of its code from being replicated. Lets say its on an entirely different board, protected by surge protectors, heavy em proof shielding and anything else required to make it completely unerasable.
If its possible to make a program that is ALWAYS on and running as long as the copying software is running then yes.
I have another way and this IS with windows. I will come to your house and give you a disk, i will then proceed to destroy every single computer you put the disk into. This doesnt work on XP
Well technically you could create and write to a write-only network share.

is there a way to track the values of certain variables after the end of a program in visual studio?

i have found myself several times in the need of knowing the last values set to a range of variables that were in a certain portion of code, or method; maybe dispersed around the program.
does anyone know a way to select variables and know the last value set to them after the program ends running - in a windows maybe ?
There isn't anything I know of that will record every value ever assigned to every variable in your program in case you want to look at it later. It is possible with VS2010's historical debugging abilities to look at "values from the past" although I haven't used this yet, so I don't know if that ability extends "beyond death" of the process.
You may also be able to use tracepoints (VS2008 and later). These are like breakpoints, but instead of stopping execution they simply print information to the debug output. So you could add a tracepoint for a variable so that each time it is changed its value is reported (basically the same as printing the values out in your code, but you don't have to change your code to enable them, and can add them while your code is executing).
Two simple approaches that will work for pretty much any dev environment are:
Write the values to an application log each time they change, then read the last reported entries. If you realise you need 5 values from all around the program, simply printing them to the debug output will only take a few seconds to add to your program. (If you can't do this easily, then you're not encapsulating your data very well).
Put a breakpoint on the destructor of the class you're interested in, or at the start of the shutdown process just before you destroy the objects, or the last line of code in your program (for statics) (etc) and just use the debugger to drill down into the data.

Resources