ruby实现石头剪刀布游戏 代码如下:#encoding: utf-8arr = [‘石头’, ‘剪刀’, ‘布’]win_arr = [[‘石头’, ‘剪刀’], [‘剪刀’, ‘布’], [‘布’, ‘石头’]]#随机computer的值,放入result数组中result = [arr.sample]while (true) puts “请输入石头、剪刀、布” input_value = gets.force_encoding(“GBK”).encode(“UTF-8”).chomp if arr.include? input_value result << i