Author Topic: General Programming Megathread - New OP  (Read 29789 times)



Well I got it working on the Raspberry Pi but only the main thread and not the secondary thread for automatic responses (responses that require no input).
 
ProgramR Interpreter wouldn't even work a few weeks ago so I guess my efforts are doing something.

-snip-
Well I got it working on the Raspberry Pi but only the main thread and not the secondary thread for automatic responses (responses that require no input).
 
ProgramR Interpreter wouldn't even work a few weeks ago so I guess my efforts are doing something.
What are you making exactly?

What are you making exactly?
I'm creating a personal AIML interpreter so I can use it for further projects, I've chosen ProgramR to save me a lot of time but it was extremely buggy so I've had to change a lot of the code.

I'm creating a personal AIML interpreter so I can use it for further projects, I've chosen ProgramR to save me a lot of time but it was extremely buggy so I've had to change a lot of the code.
neat

So, what are your opinions on lua?



Why?
At least to me, the BASIC-style "do/then...end" delimeters seem overly verbose, since you're just duplicating the info that the whitespace can already convey perfectly fine (or at least use the C-style "{..}"), not to mention that there's the pretty pointless burden of remembering whether to use "then" or "do" (or whether there doesn't need to be any). Well, and that there barely seems to be a standard library. And the lack of package managers.

Oh, and "stuff(function(a,b) return a+b end)" is a crime against humanity.

So it sounds like you don't like it because of its syntax.

So it sounds like you don't like it because of its syntax.
And the lack of an usable stdlib or package manager.

not to mention that there's the pretty pointless burden of remembering whether to use "then" or "do" (or whether there doesn't need to be any).
once you've been working with the language for a while, it's basically instinct

also, i think the only case you use "then" is in if statements, and everything else but a function uses "do", and i think that makes a lot of sense

i mean, "if something do" doesn't really make as much sense as "if something then", nor does "for i=#, # then" instead of "for i=#, # do"

everything else you've said we've gone over in the past/is your opinion so it's not really worth arguing over again lol
« Last Edit: November 30, 2012, 06:01:25 AM by Kingdaro »

once you've been working with the language for a while, it's basically instinct
But why add the distinction in the first place? It's extra learning curve for no real benefit.

everything else you've said we've gone over in the past/is your opinion so it's not really worth arguing over again lol
Fair enough, I just wanted to clarify my position based on
So it sounds like you don't like it because of its syntax.

But why add the distinction in the first place? It's extra learning curve for no real benefit.
i guess they just wanted to make it sound like english, because as i said before "if something do" doesn't really make that much sense, haha

if you don't really feel like writing ends, thens or dos, there's always moonscript, but that makes lua files way (no seriously way) loving bigger than they need to be

every time i type the word "class" in moonscript:

local SomeClass
do
  local _parent_0 = nil
  local _base_0 = { }
  _base_0.__index = _base_0
  if _parent_0 then
    setmetatable(_base_0, _parent_0.__base)
  end
  local _class_0 = setmetatable({
    __init = function(self, ...)
      if _parent_0 then
        return _parent_0.__init(self, ...)
      end
    end,
    __base = _base_0,
    __name = "SomeClass",
    __parent = _parent_0
  }, {
    __index = function(cls, name)
      local val = rawget(_base_0, name)
      if val == nil and _parent_0 then
        return _parent_0[name]
      else
        return val
      end
    end,
    __call = function(cls, ...)
      local _self_0 = setmetatable({}, _base_0)
      cls.__init(_self_0, ...)
      return _self_0
    end
  })
  _base_0.__class = _class_0
  if _parent_0 and _parent_0.__inherited then
    _parent_0.__inherited(_parent_0, _class_0)
  end
  SomeClass = _class_0
  return _class_0
end


loving christ
« Last Edit: November 30, 2012, 08:52:40 AM by Kingdaro »

was bored, so i made a rock paper scissors thing in physics

which i'm still in right now  :cookieMonster:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Game {
   static int playerScore = 0;
   static int aiScore = 0;
   
   static String input;
   static String aiChoice;
   static String[] choices = {"rock", "paper", "scissors"};
   static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
   
   static void print(String text) {
      System.out.println(text);
   }
   
   static void playerWin(String msg) {
      print("Player wins, " + msg);
      playerScore++;
   }
   
   static void aiWin(String msg) {
      print("AI wins, " + msg);
      aiScore++;
   }
   
   public static void main(String[] args) {
      print("Say 'rock', 'paper' or 'scissors'.");
      print("First to 3 wins.");
      
      while (playerScore < 3 && aiScore < 3) {
         print("Ready? Shoot!");
         
         try {
            input = reader.readLine();
         } catch (IOException e) {
            e.printStackTrace();
         }
         
         aiChoice = choices[(int) (Math.random() * 3)];
         
         print("AI: " + aiChoice);
         
         if (input.equals("rock")) {
            if (aiChoice.equals("paper")) aiWin("Paper covers rock!");
            else if (aiChoice.equals("scissors")) playerWin("Rock crushes scissors!");
            else print("Tie.");
         }
         else if (input.equals("paper")) {
            if (aiChoice.equals("scissors")) aiWin("Scissors cuts paper!");
            else if (aiChoice.equals("rock")) playerWin("Paper covers rock!");
            else print("Tie.");
         }
         else if (input.equals("scissors")) {
            if (aiChoice.equals("rock")) aiWin("Rock crushes scissors!");
            else if (aiChoice.equals("paper")) playerWin("Scissors cuts paper!");
            else print("Tie.");
         }
         else print("You're doing it wrong.");
         
         print("AI: " + aiScore + " || You: " + playerScore);
      }
      
      print((playerScore < aiScore)? "AI Wins!" : "Player Wins!");
   }
}


and yeah, i really suck at it

Say 'rock', 'paper' or 'scissors'.
First to 3 wins.
Ready? Shoot!
rock
AI: scissors
Player wins, Rock crushes scissors!
AI: 0 || You: 1
Ready? Shoot!
scissors
AI: rock
AI wins, Rock crushes scissors!
AI: 1 || You: 1
Ready? Shoot!
scissors
AI: rock
AI wins, Rock crushes scissors!
AI: 2 || You: 1
Ready? Shoot!
rock
AI: scissors
Player wins, Rock crushes scissors!
AI: 2 || You: 2
Ready? Shoot!
paper
AI: scissors
AI wins, Scissors cuts paper!
AI: 3 || You: 2
AI Wins!


:c

was bored, so i made a rock paper scissors thing in physics

which i'm still in right now  :cookieMonster:


-snip-


:c
i...i actually understand this now. my god it's beautiful ;.;