Exemple #1
0
        public void SetBid(Bid bid)
        {
            int columnNumber = PlotsCounter.GetColumnNumber(bid.plotNumber);
            int rowNumber    = PlotsCounter.GetRowNumber(bid.plotNumber);

            highestBids[columnNumber, rowNumber] = bid;
        }
Exemple #2
0
        private bool CheckIfHighestBid(Bid bid)
        {
            int columnNumber = PlotsCounter.GetColumnNumber(bid.plotNumber);
            int rowNumber    = PlotsCounter.GetRowNumber(bid.plotNumber);

            if (highestBids[PlotsCounter.GetColumnNumber(bid.plotNumber), PlotsCounter.GetRowNumber(bid.plotNumber)] == null ||
                bid.price > highestBids[PlotsCounter.GetColumnNumber(bid.plotNumber), PlotsCounter.GetRowNumber(bid.plotNumber)].price)
            {
                return(true);
            }
            return(false);
        }
Exemple #3
0
        public void Bid(Offer offer)
        {
            List <Bid> bids = offer.GetListOfBids();

            foreach (Bid bid in bids)
            {
                if (CheckIfHighestBid(bid))
                {
                    highestBids[PlotsCounter.GetColumnNumber(bid.plotNumber), PlotsCounter.GetRowNumber(bid.plotNumber)] = bid;
                }
            }
        }
Exemple #4
0
        public List <Bid> GetListOfBids()
        {
            List <Bid> listOfBids         = new List <Bid>();
            int        numberOfPlotsInRow = Auction.numberOfPlotsInRow;
            int        upperLeftColumn    = PlotsCounter.GetColumnNumber(upperLeft);
            int        upperLeftRow       = PlotsCounter.GetRowNumber(upperLeft);
            int        lowerRightColumn   = PlotsCounter.GetColumnNumber(lowerRight);
            int        lowerRightRow      = PlotsCounter.GetRowNumber(lowerRight);
            Bid        temp;

            for (int i = upperLeftRow; i <= lowerRightRow; i++)
            {
                for (int j = upperLeftColumn; j <= lowerRightColumn; j++)
                {
                    temp = new Bid(PlotsCounter.GetPlotNumber(j, i), pesel, price);
                    listOfBids.Add(temp);
                }
            }
            return(listOfBids);
        }