# Abacus

A chat/console based calculator for Minecraft with awareness of the concept of a "Minecraft stack of items". You can perform math operations on stacks to determine how many stacks of a material you need for your building projects.

## Syntax

```/abacus <formula>
```

Examples:

```/abacus 1+1 --> Result: 2
```

```/abacus 1+1*5 --> Result: 6
```
```/abacus 10*10/100 --> Result: 1
```
```/abacus 0.5*0.5 --> Result: 0.25
```
```/abacus 2*(3+2) --> Result: 10
```

## Supported Operations

Operators: + (addtion), - (subtraction), * (multiplication), / (division), \ (integer division), % (modulus/remainder), ^ (power operator).

### Random Operator

There is also a special operator that generates random numbers. Examples:

```/abacus 1d6
```

will produce a random number between 1 and 6.

```/abacus 10d6
```

will produce the sum of 10 random numbers between 1 and 6.

A future release may add a function to control the range.

## Minecraft "stack" Aware

Can perform calculations on quantities that are in the unit "stacks" (64 items) or "partial stacks" (16 items) and produce results describing the number of stacks. All the examples below are given for full stacks. Partial stack operations are identical, except that you use 'p' as the unit instead of 's'.

If you want the result expressed in terms of stacks, simply precede the formula with an 's':

```/abacus s 64 * 1
Result: 1 stacks and 0 individual items.
```
```/abacus s 32 * 2
Result: 1 stacks and 0 individual items.
```

If you want to include a quantity that is a number of stacks, append an 's' to the quantity:

```/abacus 1s + 0
Result: 64
```
```/abacus 1s + 1s
Result: 128
```

You can use both, of course, so the following, while silly, works:

```/abacus s300s
Result: 300 stacks and 0 individual items.
```

More importantly, you can do this sort of thing: You're making 300 'somethings', you've already worked out that each one takes 5 stacks of blocks plus 28 more...how many to make all 300?

```/abacus s (5s + 28) *  300
Result: 1631 stacks and 16 individual items.
```

You can mix partial and full stacks, although I'd be careful in doing so, you can potentially mislead yourself as to what is going on. One situation where this might come up is with snowballs. Snowballs are stackable in partial stacks of 16, but snow blocks are in stacks of 64. Supposing you had 30 stacks of snowballs, you could do something like this to find out how many stacks of snow blocks you could make.

```/abacus s30p / 4
Result: 7 stacks and 32 individual items.
```

## Supported Grouping symbols

(), <>, [], {}

That means this is a valid expression:

```[(1+1)*5+15]
```

## Comma Grouping

Can evaluate multiple expressions "in one go" that are separated by commas:

```/abacus 1+1,2+2,3+3
Result: 2,4,6
```

## Permission Nodes

abacus.* - grants all permissions (as there is only one right now, this is largely useless). Defaults to op. abacus.abacus - grants access to the abacus command. Defaults to true.

## Planned Features/Changes

I'm playing with an idea for computing the required materials for complex items. A potential syntax might be:

```/abacus 30 wooden stairs
Result: 30 wooden stairs requires 48 planks or 12 logs.
```

Stairs in particular is on my radar, since I frequently miscalculate the materials required for a stairway. :)

I haven't fully decided on an approach on how to do this generically yet. Suggestions welcome. :)

• 2008Choco Sep 11, 2015 at 17:48 UTC - 0 likes

Very ingenious work here :) Creative and very simple to use from what I can see. I like the simplicity and the sheer power that this plugin can have. Especially with item stacks. I can admit that I've always had issues determining how many items I need precisely without pulling out the calculator app on my laptop. Very handy, keep up the great work

```public void checkCuteness(Player Jessica3224){
Player 2008Choco = Jessica3224.getBoyfriend();
if (Jessica3224.isCute()){
2008Choco.love(Jessica3224);
}
}
```
• georgsterman567 Oct 29, 2014 at 22:56 UTC - 0 likes

Can you take away how in the answer if the answer is a very high number it does say something like:

Result: 5.9999E7

Can you make it say the plain answer? Thanks!!

• Feaelin Mar 13, 2014 at 00:54 UTC - 0 likes

@diannetea: Go: Hm. Is it really necessary? the Bukkit xp command supports levels:

```Usage: /xp <amount> [player] OR /xp <amount>L [player]
```

Thus: /xp 10L theplayer would give theplayer 10 additional levels.

• Feaelin Mar 08, 2014 at 14:57 UTC - 0 likes

@diannetea: Go: Yes.

• diannetea Mar 04, 2014 at 18:30 UTC - 0 likes

Is there any way maybe you could add exp calculations in? I hate when I'm trying to give someone x levels but I don't know how much experience I need to give to get them there.

• Feaelin Jul 08, 2013 at 00:38 UTC - 0 likes

There will be new version posted shortly (as soon as it gets approved). The new version supports parentheses-as-multiplication: 3(1+1) now evaluates correctly and also fixes a bug involving negative numbers not being handled correctly.

• Feaelin Jul 07, 2013 at 17:39 UTC - 0 likes

@MidnightChipmunk: Go

Only one: abacus.abacus. Defaults to true and grants access to the abacus command.

• MidnightChipmunk May 21, 2013 at 23:14 UTC - 0 likes

What are the permission nodes?

• Feaelin Nov 20, 2012 at 15:40 UTC - 0 likes

@Bimmr: Go

Yeah, that'd make more sense. At the time I wrote the original parser, I was writing it for table-top gaming, which is why it has the <number of dice>d<die size> format. It didn't occur to me to change how it behaved for Abacus. I think as I was writing the documentation above, I realized that that form doesn't necessarily do everything folks would want. Long term, I may add a function in this form: R(10,100) which will give a random number between 10 and 100 (inclusive). Some standard math functions (e.g., sine and the like) might go in at the same time.

I confess, right now, I more interested in the material calculator than specialty math functions. I currently have an experimental version where you can type:

```/abacus material 30 woodenstairs
```

And it tells you how many planks or logs you need, rounding up where necessary. Right now, its hard-coded for woodenstairs, I'm reflecting on how to make it handle (any? most?) materials, and still be easy to use; keeping the interface friendly and natural.

• Bimmr Nov 20, 2012 at 14:49 UTC - 0 likes

Why not use R for random instead of D?

I have moved to SpigotMc.org If you would like to continue to get updates, please visit my projects there.

### Facts

Date created
Nov 16, 2012
Categories
Last update
Sep 09, 2015
Development stage
Release
Language
• enUS