Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Community Boards > Just for Kicks Challenges

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 2.00 average. Display Modes
Old 11-27-2005, 01:44 AM   #1
amen0
Resident Evil 4
 
amen0's Avatar
 
Join Date: Aug 2005
Location: Lebanon
Posts: 444
Default mini MATLAB in Flash ;)

hi all just wanna see a flash application that can evaluate a math. expression
like
>>2+8-(5*3)
>>ans=
-5
>>sin(pi*3/2)+3
>>ans=
2
let's see ...
only to make it simple make only the arithmetic operation
as for me i can do the first one coz i programmed it in C# long ago and it's easy but the seconde i think is the Challenges.
ok guys let's see what u can do ...
amen0 is offline   Reply With Quote
Old 11-30-2005, 10:31 AM   #2
Laguana
Well known nobody
 
Join Date: Jul 2004
Location: Australia
Posts: 818
Default

Is this supposed to be in 25 < lines of code? 'Cause i've made a calculator already (works in base 12 :P) but I'm pretty sure it's more than 25 lines. Also, there's a math.eval function someone's put on layer51 which works with pretty much everything, which is pretty cool. It's certainly more than 25 lines.
Laguana is offline   Reply With Quote
Old 11-30-2005, 04:14 PM   #3
amen0
Resident Evil 4
 
amen0's Avatar
 
Join Date: Aug 2005
Location: Lebanon
Posts: 444
Default

hi, can u show us ur .swf file.
amen0 is offline   Reply With Quote
Old 12-01-2005, 12:42 PM   #4
Laguana
Well known nobody
 
Join Date: Jul 2004
Location: Australia
Posts: 818
Default

Well, it's at http://thor.prohosting.com/laguana/B12Calc.swf. It's still buggy i think, 'cause i was just messing 'round with it. Also, it uses crazy symbols 'cause me and my friends made up our own base 12 notation :P

If i recall, | is a decimal place, so 1|2 is 1.2, in base 12, so it's 1 and 2 12ths. V is 10, X is 11. ~ is the negative button, so pressing 1 then ~ should make it -1. The other symbols should be recognised already. It works fine for single operations, and follows order of operations, but brackets break it really easially.
Laguana is offline   Reply With Quote
Old 12-01-2005, 12:57 PM   #5
Morg
1st party software!
 
Morg's Avatar
 
Join Date: Nov 2003
Location: South Africa
Posts: 905
Default

Slightly off the topic...

Which is correct?
4+5*6=54
or
4+5*6=34

???

I keep wondering about this.. Conventional calclators (as in Windows calculator) show 54 as being correct... YET, scientific calculators, apply BODMAS to the equation before working it out...

If anyone knows, please let me know too...
Morg is offline   Reply With Quote
Old 12-01-2005, 06:05 PM   #6
amen0
Resident Evil 4
 
amen0's Avatar
 
Join Date: Aug 2005
Location: Lebanon
Posts: 444
Default

well Laguna this is totally different for what i m asking for
have'nt u work in the MatLap Program
it's like this
ur input is a string
>> 2*6-3
then the program respond 9
u know not input are buttons ( ur calculator is too easy to make) sorry but it's not the challenge i m asking for
amen0 is offline   Reply With Quote
Old 12-01-2005, 09:26 PM   #7
invader
Dont set yourself on fire
 
invader's Avatar
 
Join Date: Aug 2005
Location: Arizona, USA
Posts: 238
Send a message via AIM to invader
Default

Quote:
Originally Posted by Morg
Slightly off the topic...

Which is correct?
4+5*6=54
or
4+5*6=34

???

I keep wondering about this.. Conventional calclators (as in Windows calculator) show 54 as being correct... YET, scientific calculators, apply BODMAS to the equation before working it out...

If anyone knows, please let me know too...
definitely not off topic. the order of operations is imperitive for a calculator that allows input strings. basic calculators that perform one operation at a time (such as the windows calculator) don't need to worry about the order of operations, as they only compute two numbers at a time.

the equation (4+5*6) is ALWAYS equal to 34. the only reason basic calculators would return 54 is user error (it is up to YOU to enter the numbers in the right order).

aren't challenges supposed to be started with a working example? it's always suspicious when people describe a complicated task, but don't put forth the effort to do it themselves. it makes me think the originator is posting his/her CS homework assignment hoping someone will do the work for him/her for free.
invader is offline   Reply With Quote
Old 12-02-2005, 09:20 AM   #8
Morg
1st party software!
 
Morg's Avatar
 
Join Date: Nov 2003
Location: South Africa
Posts: 905
Default

Hey Invader.

Yea, I spoke to one of my old math teachers yesterday... He said the same thing. If theres no brackets, then start at the left, and run through it normally.

Thanks for the response! Much appreciated!
Morg is offline   Reply With Quote
Old 12-02-2005, 10:14 AM   #9
amen0
Resident Evil 4
 
amen0's Avatar
 
Join Date: Aug 2005
Location: Lebanon
Posts: 444
Default

oh yeah this thread is about calculation and Math Calculator, LOL
amen0 is offline   Reply With Quote
Old 12-02-2005, 11:32 AM   #10
Morg
1st party software!
 
Morg's Avatar
 
Join Date: Nov 2003
Location: South Africa
Posts: 905
Default

Ok, so back to the challenge:

amen0, you are looking for a basically 2 textfields; the ones an input field and the other an output field? You type a long equation in there, and then hit answer to see the program work it out for you?

Have you done one already?
Morg is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Developing a flash site, Part1: Some thoughts Bloom22 Other Flash General Questions 6 09-29-2006 03:10 AM
Making a flash website (flash in a flash in a flash etc...) ALehx ActionScript 1.0 (and below) 1 04-04-2005 04:03 PM
[Q] Do we need those forums??? CyanBlue General Chat 59 07-27-2004 12:13 PM
Macromedia Central CyanBlue ActionScript 1.0 (and below) 13 08-01-2003 10:05 PM


All times are GMT. The time now is 11:34 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.
You Rated this Thread: