![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Caffeinated Neural Net
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 927
Rep Power: 4
![]() |
I did one in C++ (Win32, using DevC++) several semesters ago for a C++ class, and later ported it to Java for a Java class. The C++ version is actually a console program (uses the so-called 'extended ASCII' block-drawing characters), while the Java one is graphical. In order to port the code, I had to change lots of little things to compensate for minor differences in syntax and language, and of course the drawing routines had to be totally rewritten. Still, it was an interesting exercise, and if you'd care to see the C++ source, I can put it on the net and post a link.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp |
|
|
|
|
|
#12 | |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Quote:
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
|
#13 | |
|
Caffeinated Neural Net
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 927
Rep Power: 4
![]() |
Quote:
Anyways, I don't care what you do with it, as long as you don't try to claim you wrote it. If you learn something from it, though, that's great. Also, the code might be a bit ugly (I wrote it like the night before my project was due, so it was kinda rushed, though I have tweaked it a bit since). You'll notice the drawing logic is somewhat separate from the block logic, so it should be possible to rewrite it as a graphical app without changing the core logic too much. [edit] You'll probably want to change the size of the console window it launches in (the game assumes 80x50), or use alt-enter to go to full screen. Also, the keys are as follows: ESC to exit, SPACE to pause, ALT to rotate clockwise, CTRL to rotate counterclockwise, and the RIGHT, LEFT, and DOWN cursor keys to move blocks. If you want to change the keys, it should be quite trivial. [/edit]
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp |
|
|
|
|
|
|
#14 | |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Quote:
1 question: Was this a university course? because i'm doing this for high school
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
|
#15 | |
|
Caffeinated Neural Net
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 927
Rep Power: 4
![]() |
Quote:
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp |
|
|
|
|
|
|
#16 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Alright so my tetris game is done. Now I want to add a little "bang" to the game. So I came up with a great idea. I just need your help in telling me if this is possible and can be done in Java. Here's how my idea plays out.
So you go to this website, which I created from cogeco and your able to play tetris through an applet. So far This can be done. Now on the website I want to have a highscore list for "top ten highscores". Now depending on if your score is good enough, I want to be able to upload this score to my website. Note: I'm really bad at this website stuff. But I know this much. I update my website through FTP using "FileZilla", where I can add a .html file to my folder online. However, is it possible for a java applet/ application to be able to connect to this website and update it? I'm a complete noob at this website stuff, so any help would be greatly appreciated. Just put it this way, before today I didn't even know how upload to my website.
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
#17 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#18 | |
|
Caffeinated Neural Net
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 927
Rep Power: 4
![]() |
Quote:
That said, you have three options. If you've got web hosting as part of the package from your ISP (comes with many, if not all, broadband accounts), you will likely not have any server-side scripting ability. In this case, you will need to upload the data through the prescribed method, which is FTP for you (some allow HTTP PUT operations). If you want to do this from code, you will need to negotiate the connection, submit your username and password, read the contents of the file, modify it, and then send the new contents. This means your username/password will be available to anyone who decompiles your Java .class file(s) where this information is stored, or perhaps even any script kiddie with a hex editor. In other words, this is not a secure option, at least not if you want to distribute the code to anyone you trust. The second option is only available if you have some kind of server-side scripting support on your site, which will most likely be the case for bona-fide web hosting, but not for most ISP bundled-with-account webspace. Using this technique, you can have the program submit the data in the same way a browser submits form data to the server: through the URL (the 'GET' method), or through the HTTP header (the 'POST' method). If your site supports ASP, ASP.NET, JSP, and/or CGI, you can use this method. Once you submit the data to your site, the server runs the appropriate script to process the data, and then sticks it in a file or updates a database that resides on the server (most web hosting that allows server-side scripting also provides some database functionality such as MySQL). The only potential problem with this method is that it is possible for an attacker to submit bogus data through the browser (if the data is passed in the URL) or by passing a bogus header (which can be done by various means, like TELNET). One way to discourage this might be to scramble the data in some way, and add additional data that would act as a verification, in a similar way to a checksum or hash. That way, the attacker could only re-submit the same result (and if the server-side script scanned for duplicate entries, it could reject it), but making up new results would be quite difficult. The third possibility is a mix between the two. Find someone with 'real' web hosting, and have your program submit the results there. You could still link from your site, and the remote script could generate actual HTML output to add content to your site (a table of high scores, for example).
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|