Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6563637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:52:26+00:00 2026-05-25T13:52:26+00:00

As a debugger/test program for my brainf*ck implementation, I have created the following counting

  • 0

As a debugger/test program for my brainf*ck implementation, I have created the following counting loop:

+[[>+]+]

With single byte, wrapping cells and with 30k cells with wraparound, this creates an infinite counting loop. It sets each cell to 1, then each cell to 2, etc..

My issue is, when it gets to 255, the inner loop increments the cell to 0, and then the outer loop increments it to 1 immediately. This acts as a ‘double step’ when it overflows, instead of a single step. This is the only way I could get the loop to continue infinitely with this tight of a program.

The count for each cell goes 0 -> 1 -> 2 ... 254 -> 255 -> 1 ...

While I would like it to go 0 -> 1 -> 2 ... 254 -> 255 -> 0 -> 1 ...

It is just hard to continue a loop when the current cell is zero. I have played with variations on the same theme, but none of them get it just right.

This particular program is just a trivial counting program for testing, but what will really help me with future programs is knowing how to invert the looping conditional like I need to to make this counting loop work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:52:27+00:00Added an answer on May 25, 2026 at 1:52 pm

    Try:

    +[[>+]>[+>]+]

    After the first inner loop we know the data is 0 followed by a bunch of 255’s. Move to the next cell and increment them all until we get back to the start. Then increment the first cell and start all over.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a debugger visualizer in VS2008. There are two classes i've made,
Here is my scenario: Start my test program and immediately break into the debugger
I have a native C++ ATL in-proc COM server. A separate test program calls
i want to do test and build simple debugger GUI in c++ that debugging
When I run a test harness through the Visual Studio 2005 debugger, it creates
I have Microsoft Script debugger installed and selected (somwhere) as the script debugger of
I'm working on a program which uses the System.Diagnostics.Debugger.Break() method to allow the user
The attached, trivial, test program tests the performance of emptying a simple std::map. Using
I have written a small program using Borland's C++ builder, and along the way,
Look at the following program. The comments show the order of execution when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.