![]() I forgot to attach the image icon files that will be used by the application. As they say… “I leave that as an exercise”! Hahaha □ Well I really hope I get some time so that I can add network functionality to this application. The rest of the code is self explanatory.Īnd adding keyboard support for the second player is a pretty easy job. ![]() One is the “OWNER” property which indicates which user currently owns the square and the “INDEX” property which indicates the square’s index in the grid (ie, … etc) Once any player clicks on a square, the OWNER property is updated and the victor圜ondition is checked by using the OWNER properties of all the buttons. ![]() Ive used two properties in the Buttons to store some information used for checking the winning condition. TicTacToeFrame frame=new TicTacToeFrame() SetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) īuttons.putClientProperty("INDEX", new Integer) īuttons.putClientProperty("OWNER",null) StatusBar=new JTextField("Player1's Turn") ![]() GameListener listener=new GameListener() But unfortunately I havent had the time to do so.Īnywaiz the application works like this – the game is autostarted once launched and the status bar indicates which player’s turn its now and rest is just simple tictactoe! And at the end of the game the app is automatically reset. But I thought of adding Network Multiplayer functionality to this application since I love network programming. Well to be honest, Im not really interested in writing AI apps. But after completing his code he sadly realized the basic fact that you cannot win in TicTacToe if you play perfectly!! Hehe □ So I did not venture into that area. And btw that friend of mine even developed code for the computer player. I actually wrote this code to show off some of the really cool features of Java to one of my friends who also wrote the same application in a “C++”-esque style. There’s not much to be learnt from this particular program but I really want to get outta this impasse and hence Im posting this today. ![]() But in this post Im just gonna publish a small application that I wrote sometime ago. A helluva lot of things happened in the last two months and I’ve got loads to say. Hello people! Wow its been a while since I posted something here…! I must say I really miss writing stuff and I promise I wont get into a ‘writer’s block’ again. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |