Advertisement
Guest User

checkers

a guest
Sep 23rd, 2014
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. if not os.loadAPI("cutil") then
  2.     error("checkers requires the Checkers util API (cutil) by minecraftwarlock to run")
  3. end
  4.  
  5. sides = {"left","right","front","back","top","bottom"}
  6. modemSide = nil
  7. modDir = "checkers mods"
  8.  
  9. if not fs.exists(modDir) then
  10.     fs.makeDir(modDir)
  11. end
  12.  
  13. for i=1,6 do
  14.     if peripheral.isPresent(sides[i]) and peripheral.getType(sides[i]) == "modem" then
  15.         if peripheral.call(sides[i],"isWireless") then
  16.             print("Wireless modem found on "..sides[i])
  17.             modemSide = sides[i]
  18.         end
  19.     end
  20. end
  21.  
  22. rednet.open(modemSide)
  23.  
  24. cutil.mon = peripheral.find("monitor")
  25. button.mon = peripheral.find("monitor")
  26. mon = peripheral.find("monitor")
  27.  
  28. if mon == nil or not mon.isColor() then
  29.     error("Checkers requires an advanced monitor to play")
  30. end
  31.  
  32. gamemode = cutil.mainMenu()
  33. print("gamemode: "..gamemode.." selected")
  34.  
  35. if gamemode == "lcl" then
  36.     print("Drawing board of size 8x8")
  37.     while cutil.noWinner() do
  38.         print(cutil.opponent.." turn started")
  39.         cutil.board(8,8)
  40.         cutil.nextTurn()
  41.         print(cutil.turn.." turn finished")
  42.     end
  43.     mon.clear()
  44.     cutil.cntrdTxt(cutil.winner.." wins!")
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement