Jump to content




KISS APIs - Keep it Simple, Stupid


  • You cannot reply to this topic
5 replies to this topic

#1 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 07 July 2013 - 01:23 PM

Summary


All too often I find myself wanting an API that does what I need it to and nothing more - I don't need a lot of pretty wrapping paper, I just want the meat of the product. Hence, KISS (Keep It Simple Stupid) APIs.

Current Projects


An important note!
Do not use os.loadAPI to load these APIS. Use dofile([filename]) instead.
KISS Navigation
This is an efficient turtle navigation API. It will not make any unnecessary turns, and is only 6 lines in compressed form. You should note that the turtle will navigate first along the x-axis, then along the z-axis, and finally along the y-axis.
Usage:
turtle.goto(x,y,z)
turtle.turnTo([0-3])

Pastebin Compressed -> J2pcaLBW
Pastebin Uncompressed -> ruiUdCcH
GitHub Repository

Full Compressed Code
Spoiler


KISS Button API
This button API is about as simple as it gets, and has no uncompressed version for easy perusal as I wrote it in the compressed form directly.
Usage:
#The button API has only three functions:
button:n(table) # Creates a new button
button:d() # Draws all the buttons
button:cc(int,int) # Checks if a button is clicked, and if so then returns a reference to the button

#The 'button:n()' function takes a table with these arguments:
{
	x=[x-pos];
	y=[y-pos];
	h=[height];
	t=[text];
	c=[color];
}

Pastebin Link-> F5AW5ZD3
Example program
GitHub Repository

Full Compressed Code
Spoiler

Projects in the Works

Your name here: Your project here

Currently, I do not have any more KISS APIs in the works, but if you have any contributions or suggestions then I would be more than happy to take them!

General Q/A
Do you write all the code by hand?
Yes.
Even the compressed code? Yes.
Why do you compress the code? Mainly because I think it's fun. I know, I have a sick and twisted mind ;)
I found a bug. Can I take it upon myself to fix the bug and then submit it to your GitHub repository for a merge? Certainly! I would be glad to accept any contributions you may have.
I have a program that would fit into this repository nicely... It would be awesome if KISS APIs turned into a community project. If you have a program that does things efficiently and is simple to use, by all means submit it via the GitHub repository link below and notify me through either PM or a post in this thread.

GitHub Repository

#2 diegodan1893

  • Members
  • 164 posts
  • LocationSpain

Posted 08 July 2013 - 06:39 AM

The full compressed code in Kiss Navigation is from Kiss Button and the code in Kiss Button is from Kiss Navigation

#3 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 08 July 2013 - 10:43 AM

View Postdiegodan1893, on 08 July 2013 - 06:39 AM, said:

The full compressed code in Kiss Navigation is from Kiss Button and the code in Kiss Button is from Kiss Navigation

Oops! Thanks for pointing that out.

#4 Symmetryc

  • Members
  • 434 posts

Posted 08 July 2013 - 10:53 AM

Nice, I love it :). Hopefully everyone can pitch in and expand this into something that is very useful.

#5 oedze

  • Members
  • 40 posts

Posted 22 July 2013 - 12:19 PM

i like it, but if i am playing, i wont use the navigation program, just because i dont want to get my base destroyed, can you make the program so its first goes up to like y=90(maby a config) and then goes x and z and then goes down/up to the right point???

just a feature i want to see :)

#6 NOTUSEDPLEASEDELETE

  • Members
  • 70 posts

Posted 02 August 2013 - 08:29 PM

Great work on your project!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users