Track Multiple States(Moves) in a game

Hello,
For one of my classes, we are writing a Mancala game and have an undo button to take back 3 moves. I am using ObjectOutputStream to save the file and reload the saved file if someone clicks undo.
The problem I am having is that I have to keep track of last 3 states (not one which I am doing). Any suggestions?
Thanks and happy thanksgiving ;)

kevinaworkman wrote:
Why don't you just have a Stack of those game states? When you click undo, just load the state that's on top of the stack.For all we know the OP may already be using the javax.swing.undo package, in which case a Stack would just be a crude version of the data structure already in use. But we haven't been told that. It would really help to know how the undo and redo processing is being handled in the existing code before trying to recommend changes to it.
Oops, sorry... we have indeed been told that, and the undo/redo strategy is to simply serialize the state of the game to a file. And apparently that doesn't scale to more than one level of undo. So, if you were stuck on that strategy, you could serialize the state to more than one file, and keep track of the files... using a Stack if you liked!

Similar Messages

  • How do I use the same track multiple times in different playlists? I want to rename it multiple times.

    Hi, I am an entertainer that want rename a track a music a number of different ways so it will come up in playlist that work alphabeticly.
    for instance:
    Good Song I want to change to:
    A Good Song
    B Good Song
    C Good Song
    D Good Song
    So I can place them in different playlist and keep the order straight.
    Todd

    You can't give a single track multiple sets of properties, but if you want four copies of a song with different metadata then find the original and copy/paste it three times into the Automatically Add to iTunes folder, then edit the properties of each in turn.
    tt2

  • How to get radio behavior for multiple embedded movies on a single page?

    Hi,
    I've got a single XHTML page with multiple embedded movie objects. The movies all play fine. I would like to convert the page to achieve a radio-style behavior for the movies so only one is running at any time. That is, if I click on a movie that's not running, the movie that is running will stop before the new movie begins. Any ideas on how this can be achieved? This might be more of a javascript question, but I was hoping somebody might have already done something similar. Thanks.
    Paul

    Roy,
    It's an ugly solution but you can always add a hidden dummy structure item or KF and add all variables in the first executed query in the workbook.
    - Find the query that has the most of the infobjects used in the other queries.
    - Make sure this query is executed first in WB by removing/adding it in WB.
    - Create the hidden dummy KF and add all the extra variables to this KF.
    Solution usually works fine for me, but its not really feasible if the queries are have to many different infoobjects.
    BR //Joakim

  • Exporting slices from multiple states doesn't name the 1st state

    I've tried various setups in the File > HTML Setup > Document Specific options for setting state names for exported slices, and i've tried the defaults.
    Whenever I have a page with multiple states, and i want to export a slice from each state, when it generates the files it creates:
    slicename.png
    slicename_s2.png
    slicename_s3.png etc
    how can i force fireworks to name the 1st slice with _s1

    I've tried various setups in the File > HTML Setup > Document Specific options for setting state names for exported slices, and i've tried the defaults.
    Whenever I have a page with multiple states, and i want to export a slice from each state, when it generates the files it creates:
    slicename.png
    slicename_s2.png
    slicename_s3.png etc
    how can i force fireworks to name the 1st slice with _s1

  • Multiple levels in a mobile game

    Hi
    Im a little confused on multiple levels in a j2me game with respects to re-initialising the level, once level 1 is complete.
    How, and what would be the best code practise, once level1=true(complete) to load level 2. Where do i actually send my code back too, to start the next level. Do i do some kind of garbage collection/reset, then simply load all the graphics in for level 2?.
    Also, some games feature levels like in an RPG, where each room is loaded when the character reaches the exit - how is this being called from the j2me code?
    Thanks
    Steve

    Would you be able to explain it to me?  Here is a picture of what i'm trying to do..
    When 'player_mc' touches' hitbox_mc', the movieclip 'bat_mc' plays once and erases itself.
    And for the level change its the same concept... Player touches box and gets sent to second frame on timeline which is t he next level...
    Been trying to figure this out all weekend and just turned to pros for help now..

  • Multiple statements within an if statement

    I am trying to add multiple statements within the ELSE part of an IF statement. Basically I display an error message if the fields are blank.  But if all conditions are met, I want to update a collection then save that collection.
    For example,
    If  (condition, UpdateContext({strError:"Please complete all fields."}), do statement1, statement2)
    For now I have removed the if statement to get the update collection and save collection to work.

    I am trying to add multiple statements within the ELSE part of an IF statement. Basically I display an error message if the fields are blank.  But if all conditions are met, I want to update a collection then save that collection.
    For example,
    If  (condition, UpdateContext({strError:"Please complete all fields."}), do statement1, statement2)
    For now I have removed the if statement to get the update collection and save collection to work.
    I may have found a workaround with multiple buttons.
    If a save button if pressed and all fields are completed, then the else part of the statement display a rectangle with two buttons, yes and no.  I can add all my code to the yes button select section.  the no button hides the rectangle and buttons.
    However, I would still like to know hos to utilize multiple statements within an if.  Any comments would be greatly appreciated.

  • Motion 3 - Motion Tracking and Match Move

    Hi, I have no problem learning how to use motion tracking or match move because there's plenty of tutorials online. My question is, if let's say i motion tracked a clip to my original clip and half way through the movie an obstacle comes into the position where my motion tracked clip is. How do i make is so the obstacle appears in front of the motion tracked clip?
    For example, take apple's motion 3 sample video.
    http://www.youtube.com/watch?v=BwezKN_hFF4
    The place where they put the GPS clip, if while the girl is driving she moves her hand in front of the GPS. How would we make it so that her hand appears in front of the GPS not behind it?
    Any help would be appreciated,
    Thank you

    If I am understanding you correctly, it sounds like you are asking how to have an object that is part of the background layer appear in front of an object that you are going to composite in an match-move.
    The only way to do that is to duplicate the background layer and move it in front of the layer you are bringing in, then create a mask around the portion of layer you want to keep (in the example you provide - the girl's hand).
    You would have to go frame-by-frame and animate the mask to follow her hand - very time consuming but I don't see any other way.

  • Multiple statements from one connection causes ORA-0100 Maximum open cursor

    HI,
    I am creating a connection and trying to run 2 statements off the connection. The connection has autocommit as false as I want to commit only after the second statement commits successfully. Upon executing the second statement, I get the ORAC-0100: Maximum open cursor error. I have verified that I have closed all the Preparedstatement and ResultSet in the first statement.
    My code looks like this:
    Connection myConn = DriverManager.getConnection(jdbc:oracle:thin:.....); myConn.setAutoCommmit(false); Savepoint sp = myConn.setSavePoint("save1"); PreparedStatement pstmt = myConn.prepareStatement(...) ResultSet rs = pstmt.executeQuery(); while (rs.next()){ ..... } rs.close(); pstmt.close(); rs=null; pstmt=null; Statement stmt2 = myConn.createStatement(); sql="DELETE FROM TempTable..."; stmt2.executeUpdate(sql);
    I put a breakpoint just before stmt.executeUpdate and verified the open cursor are below the threshold. And as soon as I execute stmt2.executeUpdate,I get the maximum cursor error. Also, I noticed that the number of open cursors jumps to the limit after stmt2.executeUpdate(sql) as verified by the following sql
    select s.sid, s.username,  a.value from v$sesstat a, v$statname b, v$session s where a.statistic# = b.statistic#  and s.sid=a.sid and b.name = 'opened cursors current' and s.username = 'user_name';
    Am I doing something wrong? Is there a better way to execute multiple statements using the same connection and commiting only after the last statement has executed successfully?

    I believe you need to close your connection via myConn.close() as follows:
    PreparedStatement pstmt=null;
    ResultSet rs=null;
    Connection myConn=null;
    try{
    myConn= //put code to get connection in this statement here
    pstmt = myConn.prepareStatement(...)
    rs = pstmt.executeQuery();
    while (rs.next()){
    }finally{
    if(rs!=null)
    rs.close();
    if(pstmt!=null)
    pstmt.close();
    if(myConn!=null)
    myConn.close();
    }

  • Executing Multiple Statements in a Query

    Is is possible to pass multiple statements in a query?
    ie.
    delete from table1
    insert into table1 values(1, 'cat')

    You can use a refcursor to return a result set from Oracle. Very cool and has been present Oracle since 1995 (Oracle 7'ish days). e.g
    procedure foo (arg1 in varchar2, my_cursor in out rc)
    is
    begin
    \t open my_cursor for
    \t select * from nov25t1 where col1 = arg1;
    end;
    This will return a ref cursor from the stored proc. You can use the ref cursor in most programming languages. I happen to be familiar with Java so it would be used as:
    (skipping a lot of code....this is just for demo purposes)
    OracleCallableStatement stmt = conn.prepareCall(....);
    stmt.registerOutParameter(2,OracleTypes.CURSOR);
    stmt.execute();
    //this is the interesting part
    ResultSet rs = (ResultSet) stmt.getObject(2);
    The documentation for ref cursors is in:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/06_ora.htm#1554
    HTH.
    -Raj Suchak
    [email protected]

  • Multiple access or multiple statement

    In our scenario we have multiple records coming from SAP and we have to INSERT into Database.
    We have modeled a XML-SQL jdbc document format in the target data type. There is one issue that we need to clarify here.This would be regarding the occurence of the the STATEMENT node vis-a-vis the ACCESS node.Two options which we have are:
    1)  Make the Statement unbounded and access as occurrence 1. Generate a new statement for each record and map the access for each record.
    2)  Make the Statement as 1..1, and make the ACCESS as 1..unbounded. The next step would be to generate the ACCESS node as many times as the number of records to be inserted.
    Is there a difference here? or is there an advanatage or disavantage among the above two options.

    What is the difference between having the STATEMENT tab as unbounded or the access being unbounded.
    If you have only one table with one insert statement, then there is no need to create Statement and access node as unbounded. Its occurrence could be one. If there are multiple tables to be used, you should make occurrence of Statement as unbounded. Similarly in case of multiple insert on same table, you will have to create access node as unbounded.
    Would there be muliple database queries triggered on the database in case the STATEMENT is set to unbounded?
    Yes.
    Would a case with muliple ACCESS tags and one STATEMENT tag generate just one SQL statement.
    Both will generate multiple SQL statements. Statement will create altogether a new transaction.
    The problem with multiple access could be that either all insertion would be committed or all would be rolled back. And the problem with multiple Statement would be that each insert will act as a separate transaction which surely hampers performance.
    Regards,
    Prateek

  • Best way to track multiple data elements by month

    I manage a sharepoint site and want to set up a way to allow representatives from our many offices to log in and track multiple types of information every month. Specifically they need to log in once every month to log in a statisitic on 1) office water
    consumption, 2) amount of recycling processed, 3) electricity used, etc. Any suggestions for the best way to track this in Sharepoint without having to create a new list or survey every month? Thanks!

    Hi,     
    According to your description, you want the representatives from different offices can track down many types of data monthly.
    Here is a solution for your reference:
    Create different types of columns in a list. By default, we can create such as Text, Number, Choice, Metadata fields in a list. According to your requirement, you can use Metadata
    field for selecting offices, use Number field for water, electricity consumption, use Date and Time field for recoding month.
    You can also modify the current view to sort the items for a comfortable display.
    Here is a screenshot of a demo for your reference:
    Feel free to reply if there are still any questions.
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to use multiple statements inside the "THEN" block of CASE statement?

    Below is the code:
    SET @strTempString = case @strKeyMode
    WHEN 'AUTO/CYCLE'
    THEN  @strRefID + '|' + @strRetID
    WHEN 'CYCLE'
    THEN  @strRefID + '|' + @strRetID
    WHEN 'COMMERCIAL'
    THEN  @strRefID + '|' + @strRetID
    WHEN 'ISNAP'
    THEN  set @strFName = ltrim(rtrim((Left(dbo.CleanTheStringAdv(@strFName + '  ', 2) + '  ', 2))))
    '' + @strRefID + '|' + @strLName + '|' + @strFName + '|' + @strZIPorPolType
    WHEN 'ASNAP'
    THEN  @strRefID + '|' + @strRetID
    WHEN 'MOAT'
    THEN  @strRefID + '|' + @strRetID
    else '0'
    end 
    The first 3 conditions are understandable. How to use multiple statements in 4th case?
    Here I first want to set the value as:
    set @strFName = ltrim(rtrim((Left(dbo.CleanTheStringAdv(@strFName + '  ', 2) + '  ', 2))))
    and then return the string '' + @strRefID + '|' + @strLName + '|' + @strFName + '|' + @strZIPorPolType to @strTempString. 
    Please help me remove the syntax errors.
    Thanks in advance.

    Try below SQL
    DECLARE @strKeyMode varchar(20) = 'ISNAP'
    DECLARE @SQL VARCHAR(MAX)
    DECLARE @strRefID int=1
    DECLARE @strRetID INT=2
    --FIRST WAY
    IF @strKeyMode ='AUTO/CYCLE'
    SELECT CAST(@strRefID as varchar(10))
    ELSE IF @strKeyMode ='CYCLE'
    SELECT @sql = CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))
    ELSE IF @strKeyMode='ISNAP'
    SELECT @sql = CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))+'test'+'abc'
    ELSE
    SELECT @SQL='ABC'
    print @sql
    ----SECOND WAY
    SELECT @SQL = CASE @strKeyMode
    WHEN 'AUTO/CYCLE' THEN CAST(@strRefID as varchar(10))
    WHEN 'CYCLE' THEN CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))
    WHEN 'ISNAP' THEN CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))+'test'+'abc'
    ELSE 'No Record'
    END
    PRINT (@SQL)
    --Prashanth

  • Multiple statements in a preparestatement function of Connection object?

    hi,
    is it possible to have multiple statements prepared and executed at one go?
    such as;
    PreparedStatement stmt = conn.prepareStatement("SET ISOLATION TO DIRTY READ SELECT * FROM " + srcTable);
    im trying to set the isolation to dirty read, currently on informix. I also tried using semicolon in between the two statements, but it just doesn't work. Or do i have to seperate them out, and execute twice?

    In future JDBC questions should be posted in the JDBC forum.
    yes well,
    but i didn't want the whole connection to be set to
    dirty read, can't i just set one sql query to dirty
    read?
    anyways, i think setting the isolation level at sql
    for java to execute will still not overwrite the
    .setTransactionIsolation levels, true?I don't know why you would think that. How do you think the driver is implementing this?

  • How B2B Adapter will process multiple statements in one file

    Hi All,
    I have a file of MT940 format. I am able to read the file using B2B adapter. It contains multiple statements. Each statement is having opening and closing balance.
    Now B2B Adapter is creating the instance on each statements Simultaneously.
    Problem:
    Here i need the closing balance of the 1st statement, is opening for the next statement, and i need to record the updated closing and opening balance in table. As B2B is processing independently each statement, i am not able to correlate the statement details.
    Example -
    Lets say i have 3001490311 - 16012013 MT940 File having mutilple statements, Lets say 3 statements.
    Statement 1 -
    Op Bal - 10,000, Cl Bal - 20,000
    Statement 2 -
    Op Bal - 20,000, Cl Bal - 30,000
    Statement 3 -
    Op Bal - 30,000, Cl Bal - 40,000
    I need to record the Updated closing balance in the table, As B2B Adpter starts processing the statements independently, so i am not able to corelate bettwen the statements. Please if any one has any solution for this problem, please post it immediately

    Thanks Anuj,
    Thanks for your reply. As I unchecked the translate button. while testing i came to know that, In B2B console it showing as complete, but soa process is not getting started.
    Problem:
    B2b reading the file sequentially. In My case file type MT940 Postional Flat File. As its getting the starting position of the statement, B2B is creating a instance and that instance keep on moving independently, now again B2b is keep on reading the another statements in the same file.
    Once again B2B is getting a starting position to read the statement, again creating the instance. so in the similar ways B2B is keep on creating the instance for other statement in the same file.
    But in my case i need the out put of one process should be input to the next processs. As B2B is processing independently, i am not able to correalte the processes.
    In my case I need B2b should processs first statement, till completion of the first process second processes should not initiate, so that i can use the out put of one process to input to the another process.
    Thanks
    Dilllip

  • Multiple state objects

    Hello indesigners.
    I have a made a multiple state object,its working well in swf,but its not responding to adobe interactive pdf,
    i was just wandering since its a pdf interactive shouldnt it work?or are multiple state objects onyl for swf files.
    thank you

    Native Multistate objects work only in SWF. But you can select you MSO, export selection to SWF, replace original MSO with resulting SWF, set it play on page load from Media panel and after that export Interactive PDF. That way it should work.

Maybe you are looking for

  • FI Open Interface (BTE) vs FQEVENTS

    Hi, My understanding is that FQEVENTS transaction is only active for FICA (contract account). Please correct. Is this also available for FI-AP? If FQEVENTS is not available for FI-AP, we then need to use BTE (Business Transaction Evetnts-FIBF). I hav

  • VAT declaration in Spain according RD 1065/2007

    Spanish authorities require the declaration of VAT ledgers according Real Decreto RD 1065/2007. It implies to send to the authorities the detail of all invoices which are VAT relevant in a specific format. Does anybody know if SAP is going to cover t

  • PDF Generation

    We have a need to populate a pdf from our business object model implemented in java. We currently use xml, xsl and fop to generate pdfs but our newest requirements include very complicated pdf's. Does anyone know of any another approach/tools that we

  • On the AGO Function need to Create TODATE function with Diff levels - MTD,Q

    Hi All, My Basic Requirement is to Create Time Series Function on AAA ie ( Month To Date , Quarter To Date and Year To Date ) The Logic for the AAA = XXX / Previous 3 Months Revenue. we know that we can use the AGO Function to create Previous 3 month

  • Learning Some Basics

    Hey gang, I've been learning al I can for the past few days but I'm still green as spring tree. Right now, I'm trying to customize a template so that the drop shadow text reflects the standard text I have already customized. It pulls up in the main w