Skip to content

Commit

Permalink
Updating README.
Browse files Browse the repository at this point in the history
  • Loading branch information
JEG2 committed Aug 15, 2008
1 parent 29f11d4 commit aa2333f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
18 changes: 1 addition & 17 deletions README
@@ -1,17 +1 @@
Testers Wanted
==============

This is an early attempt at a Wig-Wug simulator. I've not had much time to test it yet and I could use some help with that. If you want to help, here's what you could do:

1. Read about [Wig-Wug](http://therubyist.com/homework/wig-wug/)
2. Get [my simulator](http://github.com/JEG2/wig-wug/tree/master)
3. Look at the help for the simulator to see what is available: /bin/wig-wug --help
4. Do any of the following that interest you
* Run the code on non-Mac OS X systems to see if it's properly cross-platform
* Write a digger and run the simulator on it
* Tell me if you notice cases of the simulator not meeting the spec
* Tell me if you manage to break it
* Draw a new map (see data/maps/boxed_in.txt for the format)
* Send feedback: james@grayproductions.net

Please don't share diggers or strategies before the meeting, but feel free to share any other materials (like maps).
This is the beginning of a [Wig-Wug](http://therubyist.com/homework/wig-wug/) simulator.
27 changes: 15 additions & 12 deletions data/diggers/pathfinder.rb
Expand Up @@ -10,27 +10,26 @@ def initialize
def move!(*args)
update_map(*args)
pathfind
p @path
best_move
end

private

def update_map(distances, surrounding)
if @map
# grow map, if needed
# grow map beyond actual range, if needed
find_ruby_and_me(distances)
if @me.first.zero?
@map.each { |row| row.unshift("O") }
if @me.first <= 1
2.times { @map.each { |row| row.unshift("O") } }
end
if @me.first == @map.first.length - 1
@map.each { |row| row.push("O") }
if @me.first >= @map.first.length - 2
2.times { @map.each { |row| row.push("O") } }
end
if @me.last.zero?
@map.unshift(Array.new(@map.first.size, "O"))
if @me.last <= 1
2.times { @map.unshift(Array.new(@map.first.size, "O")) }
end
if @me.last == @map.length - 1
@map.pop(Array.new(@map.first.size, "O"))
if @me.last >= @map.length - 2
2.times { @map.push(Array.new(@map.first.size, "O")) }
end
find_ruby_and_me(distances)

Expand All @@ -56,10 +55,14 @@ def update_map(distances, surrounding)
end
@map[y][x] = "R"

# padding the map so it will pathfind to the edge
2.times { @map.each { |row| row.unshift("O") } }
2.times { @map.each { |row| row.push("O") } }
2.times { @map.unshift(Array.new(@map.first.size, "O")) }
2.times { @map.push(Array.new(@map.first.size, "O")) }

find_ruby_and_me(distances)
end

@map.each { |row| puts row.join }
end

def find_ruby_and_me(distances)
Expand Down

0 comments on commit aa2333f

Please sign in to comment.