To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.ca.rtltorontoOpen lugnet.org.ca.rtltoronto in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / Canada / rtlToronto / 9321
9320  |  9322
Subject: 
Re: What is shaping up to be the most posted-on rtl event in the history of rtl events....
Newsgroups: 
lugnet.org.ca.rtltoronto
Date: 
Fri, 19 Sep 2003 21:02:50 GMT
Viewed: 
602 times
  
In lugnet.org.ca.rtltoronto, Iain Hendry wrote:
In lugnet.org.ca.rtltoronto, Ka-On Lee wrote:

I don't understand why I keep hearing about Project X being hard.  It's not
"easy", but it's one of the easiest game I have participated.  I think prj. X
and bridge crossing had the highest number of contestant, and most of them were
successful.

The programming was far beyond my capability.  That's why I said it was hard.
How it *wasn't* impossible for anyone else is beyond me.  I simply do not
understand that kind of logic in programming, at all!  Where do you even start?

You have to think it out a bit how to structure the program as a set of loops.
This is compounded by some oft he limtiations of the RCX firmware.

I think the basic one is, very roughly:

Imagine all the squares in a line.  16x1 array.

Make an array somehow in memory of the way the pattern SHOULD look like (the X).
In NQC, because there aren't enough variables, you need to use a bitmask.

Main routine:

Cycle through all the squares, starting at one.  At cell one, does it look
right? What should be in the cell, an empty or a block?  Check reality (from the
sensor) against the target bitmask (what it's supposed to be).

The cell is "correct" as is?  Great, cycle to the next cell.

The cell is "incorrect" and needs a block removed OR a block added?

Then you have to go and find a block to put in:

Subroutine:

Go off on a mission to find the next block where one isn't supposed to be.  When
you find it, bring it back to the cell which needed it.

OR

Grab the misplaced block and go off on a mission to find the next cell where a
block is required.  When you find it, drop it off there.

Continue cycling through the main routine of looking through the squares until
you get to the end.  The pattern should match the X.

Things you can do to make it faster:

-Don't drop everything you're doing to make sure the current cell is correct. If
you don't have the right state of the cell, don't look for something to fix it
immediately, just remember it and go to the next one.  ie, if the first cell is
wrong, numbers 2-14 might be right, so you might be carrying around that block
looking for a long time.  Just note it down that you need to clear cell 1, go
and check the rest and come back later to fix it up when you realize cell 15 had
a spare block.

-Maybe hold blocks while moving around.  Not useful for 4x4, very useful for
10x10.

-Don't snake the board, go direct to the cell.

If you're asking how to invent that structure, I think it's something
programmers learn over time.

Calum



Message has 1 Reply:
  Re: What is shaping up to be the most posted-on rtl event in the history of rtl events....
 
(...) OR he could have done what I told him From DAY ONE!!! pre scan the board, and use my (TM) Kevin C. approved code. Chris (21 years ago, 19-Sep-03, to lugnet.org.ca.rtltoronto)

Message is in Reply To:
  Re: What is shaping up to be the most posted-on rtl event in the history of rtl events....
 
(...) The programming was far beyond my capability. That's why I said it was hard. How it *wasn't* impossible for anyone else is beyond me. I simply do not understand that kind of logic in programming, at all! Where do you even start? Iain (21 years ago, 19-Sep-03, to lugnet.org.ca.rtltoronto)

55 Messages in This Thread:





















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR