Yeah I know you could do it by only considering the whole numbers but it would be much easier for the consumer if they could just see them by eye.
You should add some kind of linear programming to it, might take a bit of reading to understand it, but it'll definitely be useful for someone.
[QUOTE=BAZ;22223685]
You should add some kind of linear programming to it, might take a bit of reading to understand it, but it'll definitely be useful for someone.[/QUOTE]
There's a line where I have to just stop with the features or this will never get release. Linear programming is a huge topic, and it is definitely not worth it at the moment. If anything, I should add regression calculations, intersections, and stuff like that.
Also, just finished conditional plots, which you can use for piecewise plots:
[img]http://img52.imageshack.us/img52/9063/piecewise1.png[/img]
[QUOTE=nullsquared;22224104]There's a line where I have to just stop with the features or this will never get release. Linear programming is a huge topic, and it is definitely not worth it at the moment.[/QUOTE]
I wasn't suggesting putting it in right now, it was just a suggestion for a later date. It looks more complicated than it really is.
Finished my calculator.
It's exactly 510 bytes and supports addition, subtraction, multiplication and warns on overflow.
[url=http://anyhub.net/file/floppy.img]Here's the floppy image if you want to try it for yourself[/url]
Here's a screenshot:
[img]http://ahb.me/2UD[/img]
Here's the source:
[code]
use16
org 0x7c00
mov ax, 0xb800
mov es, ax
mov ax, 0xffff
mov fs, ax
mov sp, 0x7bff
mov si, hello
call putstr
call nextline
main:
call getline
; try parse a number
mov si, 0x200
mov al, [ds:si]
cmp al, '0'
jl .nan
cmp al, '9'
jg .nan
mov bp, word 0
.numloop:
lodsb
or al, al
jz .endloop
mov cl, al
; multiply sum by 10
mov ax, bp
xor dx, dx
mov bx, 10
mul bx
; get number from current char
sub cl, '0'
xor ch, ch
; add to sum
add ax, cx
; write back
mov bp, ax
jmp .numloop
.endloop:
mov ax, bp
call pushax
call putax
call nextline
jmp main
.nan:
cmp al, '.'
je .showpop
cmp al, '+'
je .doadd
cmp al, '-'
je .dosub
cmp al, '*'
je .domul
jmp main
.showpop:
call popax
call pushax
jmp .end
.doadd:
call popax
mov bx, ax
call popax
add ax, bx
call pushax
call checkcarry
jmp .end
.dosub:
call popax
mov bx, ax
call popax
sub ax, bx
call pushax
call checkcarry
jmp .end
.domul:
call popax
mov bx, ax
call popax
xor dx, dx
mul bx
call checkcarry
call pushax
.end:
call putax
call nextline
jmp main
hello db 'RPN16 by turb_', 0
overflow db 'OVERFLOW!', 0
prompt db '> ', 0
getline:
pusha
mov bx, 0x200
mov cx, bx
mov si, prompt
call putstr
.loop:
xor ah, ah
int 0x16
cmp al, 8
je .backspace
jl .loop
cmp al, 27
je .escape
cmp al, 13
je .enter
jmp .character
.backspace:
call backspace
cmp bx, cx
je .loop
dec bx
jmp .loop
.escape:
call clearline
mov si, prompt
call putstr
mov bx, cx
jmp .loop
.enter:
call nextline
mov [ds:bx], byte 0
popa
ret
.character:
mov [ds:bx], al
call putchar
inc bx
jmp .loop
pushax:
pusha
mov bx, fs
sub bx, 2
mov [bx], ax
mov fs, bx
popa
ret
; RETURNS STACK NUMBER IN AX
popax:
mov bp, sp
pusha
mov bx, fs
mov ax, [bx]
add bx, 2
mov fs, bx
mov [bp-2], ax
popa
ret
backspace:
pusha
mov bx, gs
cmp bx, 8
jl .return
sub bx, 2
mov gs, bx
mov al, ' '
call putchar
mov gs, bx
call putcursor
.return:
popa
ret
clearline:
pusha
mov bx, 80*2*24
.clr:
mov [es:bx], word (7 << 8)
add bx, 2
cmp bx, 80*2*25
jl .clr
push 0
pop gs
call putcursor
popa
ret
putcursor:
pusha
mov dx, gs
shr dl, 1
mov ah, 0x02
mov bh, 0x00
mov dh, 24
int 0x10
popa
ret
nextline:
pusha
xor bx,bx
.loop:
mov ax, [es:bx+(80*2)]
mov [es:bx], ax
add bx, 2
cmp bx, 80*2*24
jl .loop
push 0
pop gs
call clearline
call putcursor
popa
ret
putchar:
pusha
mov bx, gs
mov [es:bx+(80*2*24)], al
add bx, 2
cmp bx, 160
jl .writeback
call nextline
popa
ret
.writeback:
mov gs, bx
call putcursor
popa
ret
putstr:
pusha
.loop:
lodsb
or al, al
jz .return
call putchar
jmp .loop
.return:
popa
ret
checkcarry:
pusha
jnc .ret
mov si, overflow
call putstr
call nextline
clc
.ret:
popa
ret
putax:
pusha
push 42
mov bx, 10
.a:
xor dx, dx
div bx
push dx
or ax, ax
jnz .a
.b:
pop ax
cmp ax, 42
je .c
add ax, '0'
call putchar
jmp .b
.c:
popa
ret
times 510-($-$$) db 0
db 0x55
db 0xAA
[/code]
I still working on my moo and i have made massive progress on it, i have finished the entire backend and about a third of the wizard commmands like adding rooms and linking them.
Sample debugging:
[code]
>id_wizard
Enter Password: ********
Player Identifyed
>look
Portal Zone
Field with a portal where you entered the game
Field : travel to field
>travel to field
Field
Field where you can see a house, portal, warehouse in the distince
Portal Zone : travel to portal
Warehouse : enter warehouse
House : enter house
>wizard_addroom
Room name: Temple of Water
>wizard_linkroom
First Room Name: Portal Zone
Secound Room Name: Temple of Water
Room1 direction code: Travel though Portal
Room2 direction code: Travel though Portal
>look
Field
Field where you can see a house, portal, warehouse in the distince
Portal Zone : travel to portal
Warehouse : enter warehouse
House : enter house
>travel to portal
Portal Zone
Field with a portal where you entered the game
Field : travel to field
Temple of Water : Travel though Portal
>Travel though Portal
Temple of Water
base room
Portal Zone : Travel though Portal
>wizard_help
Wizard Command Help
wizard_allrooms : list all rooms in the database
wizard_addroom : add a room to the database
wizard_setroomdescription : set the description of a room
wizard_linkroom : link 2 rooms together
wizard_teleport : teleport to a room by name
wizard_addentity : add a entiy from the wizards inventory to the current room
wizard_createentity : create a new entity
wizard_loaddatabase : load the database from a file
wizard_savedatabase : save the entire database to a file
wizard_writescript : create a new script and add it to the wizards inventory
wizard_runscript : run a script from the players inventory
>wizard_setrooomdescription
Room Description: Underground large room filled nearly to the top with water, you are currently standing onto of a rock in the center near the portal where y
ou entered
>look
Temple of Water
Underground large room filled nearly to the top with water, you are currently standing onto of a rock in the center near the portal where you entered
Portal Zone : Travel though Portal
>wizard_allrooms
Listing Rooms:
House
Portal Zone
Temple of Water
Warehouse
Field
>wizard_teleport
Room name: House
>look
House
Small Family House
Field : leave house
>exit
[/code]
EDIT: not all the commands on the list work
-snip misread-
Spent the past 8 to 10 hours buried neck-deep in Assembly websites, learning it properly.
Written some handy functions for printing strings or characters, along with getting keyboard input. Without using interrupts.
My head feels weird.
I'm gonna sell my TI-84+ Silver Edition calculator with sweet blue case and faceplate and only use Null's when it comes out.
also Null would it be possible to render 3d volume as transparent planes layered on the x y and z axis?
Really been trying to put a game idea of mine down. But for some reason the Release DLL version of SFML doesn't output any libs for me to connect to. I really don't want to do this on 2008, can someone tell me what's wrong? ( Using 2010 Studio )
Was wondering why when my dll was being unloaded it wouldn't unhook itself.
Forgot that the singleton I had was storing as a raw pointer. Changed it to a shared pointer.
The below works but is there anything that should be changed?
[cpp]template <class T>
class Singleton
{
private:
static boost::shared_ptr<T> singleton;
public:
static void New()
{
if (!singleton)
singleton.reset(new T());
}
static void Delete()
{
if (singleton)
{
singleton.reset();
}
}
static boost::shared_ptr<T> Self()
{
if (!singleton)
singleton.reset(new T());
return singleton;
}
};
template <class T>
boost::shared_ptr<T> Singleton<T>::singleton;[/cpp]
[QUOTE=NorthernGate;22229258]Really been trying to put a game idea of mine down. But for some reason the Release DLL version of SFML doesn't output any libs for me to connect to. I really don't want to do this on 2008, can someone tell me what's wrong? ( Using 2010 Studio )[/QUOTE]
In project properties -> General, set the platform toolset to v90.
[QUOTE=high;22230035]Was wondering why when my dll was being unloaded it wouldn't unhook itself.
Forgot that the singleton I had was storing as a raw pointer. Changed it to a shared pointer.
The below works but is there anything that should be changed?
[cpp]template <class T>
class Singleton
{
private:
static boost::shared_ptr<T> singleton;
public:
static void New()
{
if (!singleton)
singleton.reset(new T());
}
static void Delete()
{
if (singleton)
{
singleton.reset();
}
}
static boost::shared_ptr<T> Self()
{
if (!singleton)
singleton.reset(new T());
return singleton;
}
};
template <class T>
boost::shared_ptr<T> Singleton<T>::singleton;[/cpp][/QUOTE]
Make a private empty constructor and private operator new and delete. This way you ensure that other have to use Self(), New() and Delete().
Couldn't you also delete the pointer in the dlls entry-point upon DLL_PROCESS_DETACH?
[QUOTE=ZeekyHBomb;22230646]Make a private empty constructor and private operator new and delete. This way you ensure that other have to use Self(), New() and Delete().
Couldn't you also delete the pointer in the dlls entry-point upon DLL_PROCESS_DETACH?[/QUOTE]
Huh? New/Delete are just there because in some project I needed to manually Delete the singleton.
Yes, but it is a pain to do that for several singletons and remembering to do it.
Is it really worth it learning assembly?
[QUOTE=Dlaor;22231019]Is it really worth it learning assembly?[/QUOTE]
Depends, if you are just interested in doing funny windows apps, there is not a point in it really. Making a kernel and boot loader for fun, you need to know assembly. Really depends on what you like to do.
[QUOTE=aualin;22231072]Depends, if you are just interested in doing funny windows apps, there is not a point in it really. Making a kernel and boot loader for fun, you need to know assembly. Really depends on what you like to do.[/QUOTE]
Do you know of any good books or websites for learning Assembly?
[QUOTE=aualin;22231072]Depends, if you are just interested in doing funny windows apps, there is not a point in it really. Making a kernel and boot loader for fun, you need to know assembly. Really depends on what you like to do.[/QUOTE]
There are a lot more benefits to learning assembly then just being able to write it.
[url]http://stackoverflow.com/questions/422613/what-are-the-practical-advantages-of-learning-assembly[/url]
[QUOTE=high;22230826]Huh? New/Delete are just there because in some project I needed to manually Delete the singleton.
Yes, but it is a pain to do that for several singletons and remembering to do it.[/QUOTE]
If you have an interface that all singletons inherit from you could keep a global list of them for deletion upon DLL_PROCESS_DETACH.
A shared_pointer is fine too though ;)
I'd still declare the stuff i mentioned private to prohibit uncontrolled instantiation.
With operator new and delete I didn't mean you New and Delete functions ;)
Is anyone still looking for the LÖVE wiki? If so, [url=http://web.ics.purdue.edu/~dcfritz/lovewiki/][u]here[/u][/url] is a copy.
The OS Dev wiki is insanely helpful:
[url]http://wiki.osdev.org[/url]
[editline]09:42PM[/editline]
And yeah, you should learn assembly.
These days it's rather nichey and useless to most people, but it is really fun to use and helps you understand a lot more about computers if you know assembly.
[QUOTE=luck_or_loss;22229159]also Null would it be possible to render 3d volume as transparent planes layered on the x y and z axis?[/QUOTE]
Um, technically, yes, but:
- it'll look ugly unless there's a LOT of planes
- it'll be hard to approximate the exact volume which may have a certain shape to it
[editline]07:50AM[/editline]
[QUOTE=high;22230035]
The below works but is there anything that should be changed[/QUOTE]
Yeah, get rid of the singleton. If you didn't put it there in the first place you wouldn't have had this issue.
What's a good way to document an API (.NET)?
The documentation for an API I'm working with is horrendous, so I want to make notes as I'm going along -- notepad isn't quite cutting it any more.
Got most of my UI system ported from AS3 to C#:
[img]http://i50.tinypic.com/30123vp.png[/img]
Is this a good interface?
[code]test_frame = new UIMenu(
32, 32, 192, 256, // X, Y, Width, Height
"Main Menu", "border", "large", // Title, Frame style, Title font style
"default", "default", // Option border style, Option font
Color.White, true // Colour, autosize
);
test_child = new UITextBox(
256, 48, 192, 128, // X, Y, Width, Height
"default", true // Frame style, Typewriter effect
);
test_child.SetText( Res.GetItem<RText>("test_text").Text, "large", Color.Black );
test_frame.AddOption( "Test text box", this.GetType().GetMethod( "TestTextBox" ), this );
test_frame.AddOption( "Quit", this.GetType().GetMethod( "Exit" ), this );
...
public void TestTextBox()
{
test_frame.SetChild( test_child );
}[/code]
No. Make all those options properties if they aren't already, so you can do shit like:
[code]
new UIMenu {
Left = 0,
Top = 0,
Title = "foobar"'
};
[/code]
[QUOTE=CarlBooth;22231657]What's a good way to document an API (.NET)?
The documentation for an API I'm working with is horrendous, so I want to make notes as I'm going along -- notepad isn't quite cutting it any more.[/QUOTE]
You can use XML comments in the code to generate documentation: [url]http://msdn.microsoft.com/en-us/magazine/cc302121.aspx[/url]
[QUOTE=turb_;22232113]No. Make all those options properties if they aren't already, so you can do shit like:
[code]
new UIMenu {
Left = 0,
Top = 0,
Title = "foobar"'
};
[/code][/QUOTE]
Ok, I thought there might be too much going into the constructor. Thanks
I have an RP-ish thing going, that I want to have multiple paths.
[code]
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
string name;
string reply;
char strnew[255];
// The sections
int s1();
int s1torch();
int s1zombie();
int s1pit();
int s2();
int s3();
//Greeting
int main()
{
cout << "Greetings! Welcome to the Turnip Role Playing Game! \n I am the Dungeon Master! Let's begin! \n What is your first name? \n";
cin >> name;
system("cls");
cout << "Okay, " << name << ", let's get down to buisness! \n PRESS ENTER TO CONTINUE";
s1();
}
// First part of the adventure
int s1()
{
cout << "You awake in a dark area. The drip of water fills echos throughout the space. Your choices to move are NORTH, SOUTH, or WEST.\n <ANSWER IN ALL CAPS, ONE WORD>";
cin >> reply;
strncpy(strnew,reply,1);
switch(strnew)
{
case "NORTH":
s1torch();
break;
case "SOUTH":
s1zombie();
break;
case "WEST":
s1pit();
break;
default:
cout << "Unable to " << reply <<".";
}
}
int s1torch()
{
}
int s1zombie()
{
}
int s1pit()
{
}
[/code]
And the switch function apparently doesn't accept switch() functions. Help?
Protip: don't cross post.
We can read other threads perfectly fine
[QUOTE=Dacheet;22232230]I have an RP-ish thing going, that I want to have multiple paths.
/code
And the switch function apparently doesn't accept switch() functions. Help?[/QUOTE]
I guess you were trying to get around the "switch expression of type 'std::string' is illegal" error with that weird char stuff, but that's generally a bad idea, you can't just circumvent the underlying problem.
You can't use strings in switch statements; a switch statement uses integer values.
[QUOTE=Overv;22231535]Is anyone still looking for the LÖVE wiki? If so, [url=http://web.ics.purdue.edu/~dcfritz/lovewiki/][u]here[/u][/url] is a copy.[/QUOTE]
Thanks!
Sorry, you need to Log In to post a reply to this thread.