Tetris Assignment

From CSE425S Wiki
Revision as of 06:47, 3 December 2020 by Dennis.cosgrove (talk | contribs)
Jump to navigation Jump to search

possible setup issue fix

Before you embark on the assignment be sure to test out running hw6runner.rb. We have had two occurrences on Windows with Ruby 2.3 which fail producing the stack trace below:

C:\Ruby23-x64\bin\ruby.exe C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6runner.rb
C:/Ruby23-x64/lib/ruby/2.3.0/tk/itemconfig.rb:115:in `hash_kv': wrong argument type nil (expected Array) (TypeError)
        from C:/Ruby23-x64/lib/ruby/2.3.0/tk/itemconfig.rb:115:in `itemconfig_hash_kv'
        from C:/Ruby23-x64/lib/ruby/2.3.0/tk/canvas.rb:722:in `_parse_create_args'
        from C:/Ruby23-x64/lib/ruby/2.3.0/tk/canvas.rb:735:in `create'
        from C:/Ruby23-x64/lib/ruby/2.3.0/tk/canvas.rb:758:in `create_self'
        from C:/Ruby23-x64/lib/ruby/2.3.0/tk/canvas.rb:751:in `initialize'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6graphics.rb:91:in `new'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6graphics.rb:91:in `initialize'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6provided.rb:402:in `new'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6provided.rb:402:in `block in draw_piece'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6provided.rb:401:in `map'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6provided.rb:401:in `draw_piece'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6provided.rb:263:in `draw'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6assignment.rb:87:in `set_board'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6provided.rb:273:in `initialize'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6runner.rb:19:in `new'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6runner.rb:19:in `runMyTetris'
        from C:/Users/estrian/git/425-dev/src/main/ruby/hw6/hw6runner.rb:24:in `<main>'

Process finished with exit code 1

If you encounter this problem try inserting the code below at the top of hw6runner.rb:

require 'tk'
require 'tkextlib/tile'
module TkItemConfigOptkeys
  def itemconfig_hash_kv(id, keys, enc_mode = [], conf = [])
    hash_kv(__conv_item_keyonly_opts(id, keys), enc_mode, conf)
  end
end

stackoverflow

assignment

Instructions