# Trouble with a while loop

**URL:** <https://www.ruby-forum.com/t/trouble-with-a-while-loop/121725>\
**Category:** Ruby-Forum\
**Created:** [November 30, 2007, 9:04am UTC](https://www.ruby-forum.com/t/trouble-with-a-while-loop/121725 "2007-11-30T09:04:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bishar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f17d59/32.png) [@bishar](https://www.ruby-forum.com/u/bishar)\
**Post date:** [November 30, 2007, 9:04am UTC](https://www.ruby-forum.com/t/trouble-with-a-while-loop/121725/1 "2007-11-30T09:04:56Z")

</div>

Hi,

Please forgive if this forum is not the right one for this post.

I’m writing a small ruby program that implements sale of a plot of land  
to 5 investors through English Auction. In an English auction, the  
auctioneer begins the auction with the reserve price (lowest acceptable  
price) and then takes larger and larger bids from the customers until no  
one will increase the bid. The item is then sold to the highest bidder.

The logic that i’m using to implement the bidding process is this:

1. Each investor has a maximum willing price that they can’t exceed.
2. I calculate the difference or margin btw an investor’s willing price  
and the reserve price
3. The investor that has the lowest margin bids first
4. An investor’s first bid = reserve price + half of margin
5. Subsequent bids = first bid + 25% of margin i.e. half of the other  
half of margin

The code as it is now is attached.

Will appreciate any help with code and advice,

–Bashka
