Let's Talk About Lambda Functions!
hwlgw at hotmail.com
Thu Aug 22 10:55:54 CEST 2002
Duncan Booth <duncan at NOSPAMrcp.co.uk> wrote:
> hwlgw at hotmail.com (Will Stuyvesant) wrote:
> > Hmm, a nethack bot written in Python could be fun. Need to capture
> > nethack's character based output somehow.
> Anyway, extracting the output from Nethack at a suitably high level isn't a
> hard task. It is pretty well structured in that area.
How would you set out to do that?
Something like redirecting the nethack output, um,
os.system('nethack > outtputfile')
and reading the outputfile?
Or maybe it is possible to redirect to an inputstream like sys.stdin
in some way? Preferably duplicating the output so you can also use it
interactively, for example with a 'bot' button that will auto-play.
Also something like a syntaxfile would be needed that defines all the
nethack output, but perhaps it could also be done with rules like 'top
row is always a message', row 2-22 is map, column 40+ _can_ be
inventory...geez this would be complicated.
My first project would be to try to write a totally useless :-) Python
user interface for nethack that just delegates everything, both input
and output. After that it could be studied which commands could be
handled by a bot perhaps.
A great nation is any mob of people which produces at least one honest
man a century.
More information about the Python-list