Interface for chess game

Hi all,
I am new to java and in the process of finding a job. Last week i was asked by an interviewer how to design an interface for a chess game and implement it in a class. Pls. someone help with the best answer i can give.
Thanks in Advance !

johndjr wrote:
I am new to java and in the process of finding a job. Last week i was asked by an >interviewer how to design an interface for a chess game and implement it in a class. Pls. someone help with the best answer i can give.When you don't know say, "I don't know".
If you have to ask us you will never be able to pull off the fake.
back when I had to interview people I would take an honest I don't know or I'm not familiar with that over someone trying to make up an answer and looking like a fool.Interviewees were also required to answer questions on the spot rather than being given time to search the internet and prepare a canned response.
In fact in any job interview I've ever had (the last not 2 years ago) that was still the norm.

Similar Messages

  • How do I create a "command-line-interface" for a game?

    Hey people,
    For a game I need to make a DOS-like command-line-interface where the user has at least 3 options to answer with, does anyone know how to go about this?
    Hope someone here can help me out!
    Kind regards,
    Angela

    I'm not sure what part of this you are having difficulty with. Imagine for a moment that instead of asking for your end user to type something into a text-entry field and to monitor what they type (perhaps when the ENTER key is pressed), that instead you provide 3 buttons on your stage. Responding to a button press in this scenario is much the same as responding to typed user input - your movie does something based on user interaction. Going back to the user entered text scenario, a text or field sprite can detect the ENTER key being pressed and examine the string the user has entered, something like:
    on keyDown me
      if _key.keyCode = 36 then
        stopEvent
        sText = sprite(me.spriteNum).member.text
        case sText of
          "hack": -- do whatever you need to here
          "research":
          "wait":
          otherwise:
        end case
      else
        pass
      end if
    end

  • AI for Chess Game

    Ive written a chess game and need help writing the AI for the game, I have very limited time, a week to finish it and need as much help as I can get.
    http://www.mediafire.com/?rh32jk5niua37kl
    The link contains the game as it stands at the moment, in order to see the pieces the path will need to be changed in the ChessBoard class.
    Any pointers on improvements would of course be welcomes too but the main focus is on the AI.
    As far as I can tell I will need a brute force approach,
    i.e. pick a piece, evaluated possible moves, return score and do this for all pieces, I just need a bit of direction in terms of where do I start.

    Depends on how crazy you want to get with your AI.
    Are you looking for Deep Blue chess AI? Then good luck with that.
    Are you looking for an AI that just plays the game? Well that's easy enough to do... you've already mentioned a way to do that.
    i.e. pick a piece, evaluated possible moves, return score and do this for all pieces...Just go through all your pieces, see which pieces have available moves, and determine what the best move would be. If your logic determines that multiple pieces have equally the best current move, randomly choose a piece to be moved. Granted, that is a very "stupid" AI, but at least it's an idiot you can play against. ;-)

  • Chess game in Mac OS X is there a bug fix for it

    This is not a major issue but I have noticed it on all the Apple computers I have played the Chess game that comes with the Mac OS X and it seems to only involve the Pawn making an illegal move when capturing another piece. As we all know the Pawn can only capture by one space in a diagol move yet the Mac OS X supplied Chess game a Pawn will and can often capture an opponents piece that is directly next to it, yet still moves in diagnol fashion and for the same token this illegal move can is sometimes offered to me if I ask for a move hint. This is very frustrating as I play the supplied chess game often is there a fix for this bug

    Hello again Daniel...
    I found a thread where "cornelius" suggested corrupt preferences as a potential cause for Chess problems...
    His solution was to go to your Home > Library > Preferences and drag your com.apple.Chess.plist to the DeskTop and Restart your computer and reopen the Chess game...see the link
    http://discussions.apple.com/thread.jspa?messageID=2758136?
    Good Luck dave
    iMac G5 17/1.8/FirstGen/1GB RAM Mac OS X (10.3.9) Seagate200GB/WD160GB/iSight/Shuffle/SecGen Nano2GB
    iMac G5 17/1.8/FirstGen/1GB RAM   Mac OS X (10.3.9)   Seagate200GB/WD160GB/iSight/Shuffle/SecGen Nano2GB

  • Chess game that is peer to peer for Mac?

    Hello all. Anyone know of a chess game that can be played over the internet that is peer to peer? I know there are many chess games that can be played over the internet, but we would just like to launch a chess game and play each other without having to go to a third party server.
    Thanks,
    Apple //GS

    Big Bang Chess, part of Freeverse's Big Bang Board Games allows you to enter in the IP address of some with whom you wish to play, so that looks like it would do what you want, though I've not tried it.

  • Programming a Chess-game - Design Tips

    Hello,
    I'm definatly not new to programming, but I'm a beginner at Java. Now I'm trying to program a little chess-game, which should teach me some OOP-techniques and to get some experience with Java.
    Well, I have some ideas for the game in mind and already realized a few things, but I want to do it the right way and get some advice from you.
    - The chess board:
    Currently, I have a class handling the drawing of the board, getting the screen-coordinates, etc.. The class "GameBoard" extends a JPanel and I overwrite the "paintComponent"-method to draw the board.
    I have a second class "Field" that stores informations of one field: What color the field is, which piece is placed on this field and which player "owns" it. Also, each one of these "Field" is getting passed its coordinates on the screen from "GameBoard". This helps me later, when I want to decide, if the field is clicked or not.
    Now, is this a good way to implement the board and the fields? I have another option, which would be, that I throw out the class "GameBoard" and instead have a "FieldHandler" class. Now, the class "Field" would extend JPanel, overwrite "paintComponent" and draw a square on the screen. "FieldHandler" gives each "Field" the information, if it should be black or white. "FieldHandler" would also calculate the x- and y-coordinates for each field.
    Is this method better? I don't really know performance wise, because I have to add 64 JPanels to the contentPane, which means, that all 64 Panels need to be drawn seperately. I don't know if this is a good way, but maybe it doesn't really matter. One advantage would be, that I could change the color of a field easily, for example when I click or hover it, which is not that nercassary, but still nice.
    Maybe there is an even better way?
    - The Pieces:
    Well, I don't really have a clue how to draw the pieces on the board. I could also make them extend JPanel and then draw the image onto some coordinates. But that doesn't seem too right. What about BufferedImage? I don't really know how to use it, neither when it is appropriate to use. I think I get more advantage of this, when I have animations, but that's definatly not my intention.
    The only thing I know is, that I can show an image on the screen with:
    ImageIcon test = new ImageIcon("Test.gif");
            public void paintComponents(Graphics g) {
                test.paintIcon(this, g, 100, 100);
            }But is this right or even way to do it? I'm somehow unsure, if an "ImageIcon" is right for a chess-piece. Any other ways of doing this?
    The "Piece"-class itself is just an interface that the classes "Knight", "King", etc. extend. It draws the piece onto the screen, set the owning player, sets the coordinates of a piece (with the help of the "Field"-class; The Field doesn't know it's exact coordinates, just "A7", "E3", etc.) and some other functions. All pieces are handled by a "PieceHandler", which could provide functions for counting all pieces on the field, initialising every piece and maybe some more things.
    Anybody got some advice on this approach?
    This should be enough for now. I would be very thankful for any kind help, I really want my first project to be as good as possible, since I want to learn OOP and Java better.

    - The chess board:
    Currently, I have a class handling the drawing of the
    board, getting the screen-coordinates, etc.. The
    class "GameBoard" extends a JPanel and I overwrite
    the "paintComponent"-method to draw the board.
    I have a second class "Field" that stores
    informations of one field: What color the field is,
    which piece is placed on this field and which player
    "owns" it. Also, each one of these "Field" is getting
    passed its coordinates on the screen from
    "GameBoard". This helps me later, when I want to
    decide, if the field is clicked or not.
    Now, is this a good way to implement the board and
    the fields? I have another option, which would be,
    that I throw out the class "GameBoard" and instead
    have a "FieldHandler" class. Now, the class "Field"
    would extend JPanel, overwrite "paintComponent" and
    draw a square on the screen. "FieldHandler" gives
    each "Field" the information, if it should be black
    or white. "FieldHandler" would also calculate the x-
    and y-coordinates for each field.
    Is this method better? I don't really knowWhat I'd do: just paint a chessboard pattern from a static image. Can be loaded from a file, or can be generated once dynamically. Don't care at all about fields.
    Have some pixel-to-field coordinate mapping somewhere. Should be nothing but a simple multiplication.
    Have a List of chess pieces. Have those know what they look like (maybe using a delegate object which contains an image), have those know where they are and where they can go. When painting, iterate over the list, transform the coordinates to pixels, get the UI delegate and paint its image. Why bother calculating 64 fields if all you have are 32 pieces or less? And whether a field is black or white doesn't matter to the game.
    When the user clicks onto the board, get the coordinates of the click and transform them to the field coordinates, that you can then look up in the list of figures. If you find one, you can still paint a marker onto the board and underneath the piece image.
    This is what I'd do. Other approaches might make sense as well..

  • Interface with Yahoo Games?

    Hello:
    I would like to try to write an my own applet to interface with the game server at Yahoo. Is that possible? Can someone points me to the documentation of how to interface with Yahoo game servers, please?
    Thanks.

    Of course it's possible. However, they must first define an API or some interface for using their games. You need to get in touch with the people at Yahoo and find out what their interface is. You may use EJB, RMI, or who knows. You may have to use JNI, but it all depends on how Yahoo has their games setup. Without more information, I can't give you a specific answer.

  • Tutorial? on a Macromedia Mx 2004 UI design for a game or movie?

    I was looking for a few tutorials or links to help me out with making a UI in Macromedia Mx 2004 for a game or movie. I know the Halo 2 interface was made in Director. Any help is appreciated.

    If you want help with Director then please repost in the Director forum.

  • How to create chess game using Adobe flash CS3

    I want to develop a web application that when a user is login the game will automatically search for oppents onlinethat are accessing the same website. I want to design a chess game that does not contain any AI programming. What I want is that a simple chess setup that online user can only play.

    use google to search for tutorials.  that's a very complex undetaking so unless you feel you have advanced programming skills, you would be better served starting with a simpler game like tic-tac-toe.

  • Help in a chess game

    hi can anyone help me? i would like to create a simple chess game for only two players.

    hi can anyone help me? i would like to create a
    simple chess game for only two players.in contrast to a simple chess program for more than 2 players?
    A chess program for 2 players is rather simple, it only needs an engine to determine whether a proposed move is legal or not.
    The tricky part is adding a computer player.

  • Chess game

    I need guidance on how to model a chess game that involves two human players. Since this a Java oriented game and I am a new user as well as a learner, I need to be guided on the number of classes that can be incorporated in this game as well as the substantial roles of each class. I have tried examining some of the classes to involve the Board class, Piece class, legal move checker which extends board as well as the GUI on which the entire game shall be run. I need guidance on how I can join all the classes as well as some hints on attributes and operations that shall be involved in these classes.
    I have been thinking of sub classifying the piece class into sliding pieces and the non sliding pieces as well as representing pieces as images on the board. In my game, Enpassant rule is not operational, the pawn piece does not become updated at the end of the board and the castling rule does not apply too.
    I need to have my players on the same computer not on different computers or the Internet.

    As a new user/learner, you should try something a little less ambitious like checkers, and if thats too hard, Tic Tac Toe. It may sound like im joking about your abilitys, but creating Tic Tac Toe using classes for X's O's and the Board, will give you the basic understanding of how classes interact with each other, and how to design a basic object oriented game.
    It's only a small step from Tic Tac Toe, to Chess IMHO since chess only adds more game logic rules, but the class scenario is going to function pretty much the same, only more methods and rules to follow. Once you reach the point of creating the chess game, it's only a matter of creating a basic piece thats extended by all the various piece types who define their own movement rules.
    -Adam

  • Chess game programming

    I have to create a text-based chess game between uppercase and lowercase letters against each other using a two-dimensional arrays.
    1. I have to create the board and initialize the position of the letters.
    2. I have to give the output of the initial state of the game, showing the board and the first positions of the letters.
    3. I have to create the moves.(Meaning that i have to create an input to perform the entering moves)
    And i have to make sure that with every bad input the program will to repeat the input....
    If anybody of you have programmed a chess game like this before, i would appreciate any kind of help....
    Edited by: 812599 on Nov 17, 2010 8:26 AM

    mario.beka wrote:
    meacod wrote:
    812599 wrote:
    I have to create a text-based chess game between uppercase and lowercase letters against each other using a two-dimensional arrays.
    1. I have to create the board and initialize the position of the checkers.Just to give you a nudge - are you familiar with chess? What's the size of the board? How might that affect the structure you store your 'pieces' in? How will you represent pawns as opposed to kings, queens, rooks, and so forth?
    Scratch out some ideas on paper,
    Turn that into some pseudocode,
    Write some Java,
    Then come back to us if you have a specific question.Yeah that's the problem, cuz i have never played chess in my life....I'm just reading around now for the rules and movements of this game...in that case, don't bother.
    A decent chess program requires in-depth knowledge of the game, knowledge only gained through years of playing it at competition level.
    I've a small library of books about chess, have played it for going on 30 years, plus 15 years experience using Java professionally, and I'd not consider writing a chess playing program in Java as something I'd undertake on my own (and yes, I've studied the possibility of writing just that in a variety of languages I know about over the years, and even made a start a few times only to abandon it when the project became too big for me to handle).
    If you're only looking to make a digital chessboard, that's a much simpler task and one that you can certainly attempt even without knowing the game (except maybe the starting positions and accepted icons for the pieces and the size and nomenclature for the board and its fields).
    Start with that, then add rules validation as players move pieces. Start with large rules (like enforcing that pieces can only move legally, in itself a somewhat daunting task as there are several pitfalls and special rules depending on piece positions).
    At this stage there's still no AI, no computer player option. That's where the real work sits, and it's very much a non-trivial task.

  • Chess Game On Oracle Form 6i

    Hi Friends
    I have created chess game on Oracle Developer Form 2000 6i & my problem is that i have created some function for moving of Bishops, Kings, Queen, Knight etc. on Push Button and my Function of Knight is ..
    FUNCTION check_move_knight(p_from in varchar2, p_to in varchar2) RETURN BOOLEAN IS
    BEGIN
    If
              abs(substr(p_from, 2,1) - substr(p_to, 2,1)) = 2     and
              abs(substr(p_from, 4,1) - substr(p_to, 4,1)) = 1
              or
                        abs(substr(p_from, 2,1) - substr(p_to, 2,1)) = 1     and
              abs(substr(p_from, 4,1) - substr(p_to, 4,1)) = 2
    then
              return true;
    else
              return false;
         END IF;
    END;
    I want to write Function of King and Queen please tell me which type of function i can write on form ... :)
    Thanks & Regards
    Adeel

    You are playing with a 8*8 matrix.
    I suppose that you have an in memory PL/SQL table to simulate this matrix, with 1 if there is an item else 0.
    The King (exept the special move he can do only once - castling ?) can move only one square around, so X and Y can be -1 or +1
    The Queen can move like a pawn, a bishop and a tower.
    Francois

  • Chess game hangs in Leopard

    Hi:
    This isn't really an earth-shattering problem, but I've found that the Chess game that is resident in Mac OS hangs up in Leopard. I'll be playing a game, and all of a sudden, the computer will simply not make a move, and that's it. Can't undo, can't go forward. Doesn't seem to matter whether I have the computer set to play stronger or faster.
    This never happened in 10.4 on my old Quicksilver G4, and I was wondering if anyone has any experience or insight into this?
    Thanks.

    The problem seems to be a bug in the logic, although I have not looked at the code to confirm it. For those that have the time, I have included the game log to cause the game to fail. From that, you should be able to identify the problem and offer a fix. Note, the earlier Chess version (2.1) running on Tiger does not seem to have the same bug, but the issue it could very well be an OS issue.
    Chess version 2.3, running Leopard on MacBook Pro.
    Player is White; Computer is Black (obviously);
    Moves:
    1. d2-d4 d7-d5
    2. h2-h4 a7-a5
    3. h4-h5 a5-a4
    4. Nb1-c3 Nb8-c6
    5. e2-e4 e7-e5
    6. e4xd5 Nc6xd4
    7. Ng1-f3 a4-a3
    8. b2-b3 Nd4xf3
    9. Qd1xf3 Bc8-d7
    10. g2-g4 Bf8-d6
    11. Nc3-e4 Bd6-b4
    12. c2-c3 Bb4-e7
    13. g4-g5 f7-f5
    14. g5xf6 Ng8xf6
    15. Ne4xf6 g7xf6
    16. h5-h6 Rh8-g8
    17. Qf3-h5 Rg8-g6
    To get Chess to "hang", White has to place the Black Rook at G6 in jeopardy by either moving White's Rook at H1 to G1 or White's Bishop at F1 to D3...either move will cause Chess to "hang" as Black never recovers and makes a move. The bug is inconsistent in that moving White's Rook at H1 to H2 and then from H2 to G2 does not cause the bug, but moving White's Bishop from F1 to E2 and then to D3 when Black's Rook at G6 is exposed (Black moves pawn F6 to F5 and then to F4) does cause the bug.
    On my system, this is the only time it hangs. Higher skill levels have never caused Chess to hang.
    Happy Bug Hunting.
    First one to fix it wins.
    -911eDoc

  • Chess Game Complete

    Hi Everyone
    I have finally completed the first launch of my AFCS chess game.
    Hopefully it will turn out to be a worthy example of what is possible with AFCS.
    Please have a try at http://www.happydaygames.com.au ( offcourse you might need to source an opponent as there are probably no players at the moment ). If you can't source an opponent there is also an example of a single-player Sudoku game I have developed on the site.

    Thanks Aponnusa
    It's great to have some positive feedback!
    I have put a new feature in which allows you to challenge a player that is not online. An email is sent to the player for acceptance. Hopefully this makes it easier to find a game.
    There are now two lobby tabs - one for online players (on click an AFCS challenge Alert is sent) and another for offline players (on click an email is sent)
    Enjoy!
    Oliver

Maybe you are looking for

  • Best way to produce reports if the data model is in RDBMS

    we have database available in RDBMS.we will have to create reports out of that database. Anyone suggest me best way(by considering all the factors) to get the reports if database is in RDBMS. what are all need to follow in physical layer and what are

  • When oraInst.loc file is created during installation on  linux ?

    * QUES during installation :* Is this  really true  ? When executing  orainstRoot.sh , It creates the inventory pointer file (/etc/oraInst.loc). In my case , " the file was created before executing orainstRoot.sh " + As far as I know , end of the ins

  • Protected methods, what did i do wrong?

    Hi there, I'm trying to understand why I cant access a Protected Method from a library that I'm trying to use.. Some guidance would be great: public class Registration { //Create new instance of ConnectionBean ConnectionBean conBean = new ConnectionB

  • How to use forecast functions correctly?... Program doesn't work.

    Have anybody tried to make some forecast using the example programs Autofcst, QueryAll, etc. (Oracle Services Language Help)? I took these programs as a templates and tried to make my own over our database. First the simple ones. But It didn't work.

  • Deleted Utilties and CD problems - Completly stuck

    hi there, I writing this from my girlfriend who uses an Apple MacBook, OS X 10.4.11 Intel Core Duo. She once deleted the the "Utilties" folder and seems also to have problems with her CD drive. As I am "PC" I have no glue how to fix those kind of iss