Results 1 to 4 of 4

Thread: Logic problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Logic problem

    6) Set "expectedFrameCounter" to the value returned by processLine + 1 and continue.
    Are you doing this? After Step 0), if frame 0 is missing, then the expected frame counter for the next frame should be 2, not 1. At Step 0) the actual frame counter is 1, so the next expected frame would be 2 (real frame counter + 1), not 1 as you say in Step 1).

    You have also made an error starting with Step 1) about what value the missing frame should have. In Step 0), frame 0 is the missing one, frame 1 was found instead. In Step 1), you should be looking for frame 2, since that should be the next one after the frame that was found in the previous step. Instead, you ask "missing frame 1?" which is wrong. It should be "missing frame 2?" and the answer is NO.

    If you had implemented the algorithm correctly, the results would be:

    Step 0) expected frame_counter: 0, real frame_counter 1 -> missing frame 0? YES, Your algorithm says YES <= OK
    Step 1) expected frame_counter: 2, real frame_counter 2 -> missing frame 2? NO, Your algorithm says NO
    Step 2) expected frame_counter: 3, real frame_counter 3 -> missing frame 3? NO, Your algorithm says NO
    Step 3) expected frame_counter: 4, real frame_counter 4 -> missing frame 4? NO, Your algorithm says NO
    Step 4) expected frame_counter: 5, real frame_counter 5 -> missing frame 5? NO, Your algorithm says NO
    Step 5) expected frame_counter: 6, real frame_counter 6 -> missing frame 6? NO, Your algorithm says NO
    Step 6) expected frame_counter: 7, real frame_counter 7 -> missing frame 7? NO, Your algorithm says NO
    Step 7) expected frame_counter: 8, real frame_counter 8 -> missing frame 8? NO, Your algorithm says NO
    Step 8) expected frame_counter: 9, real frame_counter 10 -> missing frame 9? YES, Your algorithm says YES <= ok
    Step 9) expected frame_counter: 11, real frame_counter 11 -> missing frame 11? NO, Your algorithm says NO
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. The following user says thank you to d_stranz for this useful post:

    franco.amato (29th September 2022)

Similar Threads

  1. Three Valued Logic
    By Milica in forum Qt Programming
    Replies: 1
    Last Post: 4th December 2014, 21:44
  2. [QThread][QQueue] - logic problem !
    By Abdelhadi in forum Newbie
    Replies: 4
    Last Post: 20th April 2014, 14:01
  3. qt quick using c++ for the logic
    By fearu in forum Qt Quick
    Replies: 9
    Last Post: 17th January 2013, 11:34
  4. need help in getting a logic to work
    By eva2002 in forum General Programming
    Replies: 3
    Last Post: 29th January 2010, 08:30
  5. QSQLITE logic error
    By cyberboy in forum Qt Programming
    Replies: 11
    Last Post: 10th February 2008, 19:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.