[java] java turing machine

Started by
3 comments, last by jsgcdude 19 years, 5 months ago
I have to hand in a turing machine program by about 1:15 today written in java. I have the main features planned etc but this is the only java program i have wrote except hello world. My main problem seems to be setting up the Gui (positions etc). Aslo I have no idea how to read input from a file (the tape and the TM states). Any tips?
Advertisement
use InputStream in=(new URL("name of the file")).openStream();
use int input=in.read(); to read a byte. (don't forget to inport java.io.* and java.net.*) (and don't forget to catch exceptions);

What does the GUI of a turing machine looks like? Can't you just print all the information with System.out.print("something");?
Why do my programs never work on other computers?
Thanks for that.

I suppose I could just use system out.

I was wanting it to show you graphically what was happening at each stage and allow you to add in new instructions while the program was running.

A bit ambitious to do in a day I think.

Do you have any examples of a TM in java that doesn't use a GUI?
just make it like a CUI(Console User Interface) chat program, you really don't need a GUI, since even if you do use a GUI, it will be all text I/O anyway
No I don't have such examples. (by the way,I hope you're in an other time zone than I).

What would you need? A large boolean array, or maybe you could use a java.util.BitSet.

boolean[] bits=new boolean[256];

I do not know much about turing machines. Are the instructions coded in the same array, or are the instructions coded somewhere else? Anyway, I suppose you'll need some code to parse instructions.
Why do my programs never work on other computers?

This topic is closed to new replies.

Advertisement