<commit_before>local mockInv = require("test/ocmocks/mock_inventory")
local robot = {}

function robot.detect()
  return false, "air"
end
function robot.detectUp()
  return false, "air"
end
function robot.forward()
  print("robot: forward")
  return true
end
function robot.back()
  print("robot: back")
  return true
end
function robot.turnLeft()
  print("robot: turnLeft")
  return true
end
function robot.turnRight()
  print("robot: turnRight")
  return true
end
function robot.turnAround()
  print("robot: turnAround")
  return true
end
function robot.up()
  print("robot: up")
  --return false
  return true
end
function robot.down()
  print("robot: down")
  return true
end
function robot.inventorySize()
  return 32
end
function robot.select(slot)
  print("robot: select " .. slot)
  mockInv.selected = slot
end
function robot.place()
  local stack = mockInv.get()
  if not stack or stack.count <= 0 then
    print("robot: place (fail)")
    return false, "empty slot"
  end
  stack.count = stack.count - 1
  if stack.count <= 0 then
    mockInv.slots[mockInv.selected] = nil
  end
  print("robot: place " .. stack.name .. "(" .. stack.count .. ")")
  return true
end
function robot.placeUp()
  local stack = mockInv.get()
  if not stack or stack.count <= 0 then
    print("robot: placeUp (fail)")
    return false, "empty slot"
  end
  stack.count = stack.count - 1
  if stack.count <= 0 then
    mockInv.slots[mockInv.selected] = nil
  end
  print("robot: placeUp " .. stack.name .. "(" .. stack.count .. ")")
  return true
end

package.preload.robot = function() return robot end<commit_msg>fixes stack size usage<commit_after>local mockInv = require("test/ocmocks/mock_inventory")
local robot = {}

function robot.detect()
  return false, "air"
end
function robot.detectUp()
  return false, "air"
end
function robot.forward()
  print("robot: forward")
  return true
end
function robot.back()
  print("robot: back")
  return true
end
function robot.turnLeft()
  print("robot: turnLeft")
  return true
end
function robot.turnRight()
  print("robot: turnRight")
  return true
end
function robot.turnAround()
  print("robot: turnAround")
  return true
end
function robot.up()
  print("robot: up")
  --return false
  return true
end
function robot.down()
  print("robot: down")
  return true
end
function robot.inventorySize()
  return 32
end
function robot.select(slot)
  print("robot: select " .. slot)
  mockInv.selected = slot
end
function robot.place()
  local stack = mockInv.get()
  if not stack or stack.size <= 0 then
    print("robot: place (fail)")
    return false, "empty slot"
  end
  stack.size = stack.size - 1
  if stack.size <= 0 then
    mockInv.slots[mockInv.selected] = nil
  end
  print("robot: place " .. stack.name .. "(" .. stack.size .. ")")
  return true
end
function robot.placeUp()
  local stack = mockInv.get()
  if not stack or stack.size <= 0 then
    print("robot: placeUp (fail)")
    return false, "empty slot"
  end
  stack.size = stack.size - 1
  if stack.size <= 0 then
    mockInv.slots[mockInv.selected] = nil
  end
  print("robot: placeUp " .. stack.name .. "(" .. stack.size .. ")")
  return true
end

package.preload.robot = function() return robot end
{'fraction_non_alphanumeric': 0.13058419243986255, 'fraction_numerical': 0.00499843798812871, 'mean_word_length': 3.5742857142857143, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3270643', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1048, 'n_words': 322}