From ab8585e6a9e88ae2f1c7797aeb6b45fb277b58a6 Mon Sep 17 00:00:00 2001 From: davidyxu Date: Mon, 18 Mar 2013 18:45:15 -0700 Subject: [PATCH 1/2] Update minesweeper.rb --- minesweeper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/minesweeper.rb b/minesweeper.rb index dc42a57..1e78590 100644 --- a/minesweeper.rb +++ b/minesweeper.rb @@ -1,5 +1,8 @@ +# REV: You probably don't want to include the .txt files for your high scores & saves into your git repo + require 'debugger' require 'yaml' +# REV: Nice with the color! require 'colorize' class Minesweeper @@ -16,6 +19,7 @@ def user_settings puts "Do you want to load a saved game? Yes/No" @saved = gets.chomp.downcase + # REV: I think you could bring the if saved statement from below up here, would be helpful for clarity. if @saved != "yes" puts "Board size?" @size = gets.chomp.to_i @@ -32,6 +36,8 @@ def run @gameboard = Board.new(@size, @mines) end + # REV: How does the game time interact with saves? You may need to keep multiple time intervals + # to get accurate time recordings @gameboard.print_high_scores start_time = Time.now @@ -241,4 +247,4 @@ def print_high_scores y = Minesweeper.new -y.run \ No newline at end of file +y.run From 6a3fbd15dae48c5c8efb8a9f6f98983e584ec4fc Mon Sep 17 00:00:00 2001 From: davidyxu Date: Mon, 18 Mar 2013 19:43:03 -0700 Subject: [PATCH 2/2] Update minesweeper.rb --- minesweeper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/minesweeper.rb b/minesweeper.rb index 1e78590..39a9326 100644 --- a/minesweeper.rb +++ b/minesweeper.rb @@ -215,6 +215,7 @@ def check_bomb(pos) [pos[0]-1,pos[1]], [pos[0]-1,pos[1]-1], [pos[0]-1,pos[1]+1], [pos[0]+1,pos[1]-1] ] + # REV: An alternative to the position array that you could try is [-1, 0, 1].product([-1, 0, 1]).select @check_pos.select! do |position| position[0] < @size && position[1] < @size && position[0] >= 0 && position[1] >= 0 end @@ -234,7 +235,7 @@ def high_scores(name, duration) line.puts @high_scores.to_yaml end end - +# REV: Nice job with the high scores table, my partner and I had to write a lot more code to get the same effect def print_high_scores high_scores = YAML::load(File.read("high-scores-minesweeper.txt")) puts "**HIGH SCORES**"