Open Side Menu Go to the Top

04-19-2012 , 11:21 PM
Quote:
Originally Posted by Burnss
haha yes :P not allowed to use that ha, ive been staring at this for ages! only allowed to use sort and my own function

I guess i should sort all the values, then check one by one if they are equal to each other. If so, drop the head of it? if not, append it to removeduplicates xs. Hmm now how to do that

edit: i realised i used elem in first example i gave which i shouldnt of

but can i sort them given how the top of the function is 'removeduplicates :: Eq a => [a] -> [a]' im such a noob with haskell!
Can you use list comprehensions?

Code:
Prelude Data.List> let { rd0 []=[] ; rd0 (x:xs) = x : rd0 ([c | c <- xs , c /= x ])}
Prelude Data.List> rd0 "dgheihhdi"
"dghei"
Prelude Data.List>
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
04-19-2012 , 11:24 PM
Quote:
Originally Posted by NoahSD
Re nerd alert: Depending on the order of operations, it's either five or zero.
What am I missing? How did you get 5?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-19-2012 , 11:30 PM
Quote:
Originally Posted by Neko
Can you use list comprehensions?

Code:
Prelude Data.List> let { rd0 []=[] ; rd0 (x:xs) = x : rd0 ([c | c <- xs , c /= x ])}
Prelude Data.List> rd0 "dgheihhdi"
"dghei"
Prelude Data.List>
yehh pretty sure i can!

can you just quickly explain it please? i understand all the values etc, just not 'how it comes together'

rd0 [] = []
rd0 (x:xs) = x: rd0([c | c <- xs, c /= x])


it works thankyou! For someone whos wanted to be programming and go into field of computers all my life, i havent got a very good mind for it ha!

Last edited by Burnss; 04-19-2012 at 11:35 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-19-2012 , 11:30 PM
Quote:
Originally Posted by Neko
What am I missing? How did you get 5?
By missing one of the fives .

I nerdowned myself pretty hard.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 12:28 AM
Quote:
Originally Posted by Burnss
yehh pretty sure i can!

can you just quickly explain it please? i understand all the values etc, just not 'how it comes together'

rd0 [] = []
rd0 (x:xs) = x: rd0 [c | c <- xs, c /= x]


it works thankyou! For someone whos wanted to programming and go into field of computers all my life, i havent got a very good mind for it ha!
Do you know list comprehensions? If not, here are a couple of simple list comprehensions to give you an idea of what they do:

Code:
Prelude> [x*2 | x <- [1,2,3,4]]
[2,4,6,8]
Prelude> [x*2 | x <- [1,2,3,4], x == 4]
[8]
Prelude> [x*2 | x <- [1,2,3,4], x /= 4]
[2,4,6]
Prelude>
so the list comprehension [c | c <- xs, c /=x] says "give me the list of all elements in xs if the element is not equal to x". In Python that would be written [c for c in xs if c != x].

We have our input list (x:xs) which is split into it's head element (x) and tail elements (xs) so this, "rd0 [c | c <- xs, c /= x]", means call rd0 again with all of the elements that are not the current head element (x).

So x : rd0 [c | c <- xs, c /= x] builds up a new list by taking the head element and the tail elements filtered to remove the head element. Since we reduce the size of the input list on every recursive call to rd0 eventually we get an empty list at which point we're done.

Sorry, this explanation sucks as I have a very tough time articulating how recursive functions works

Here is the exact same thing in Python which is more verbose and maybe easier to understand:

Code:
def rd(x):
    print "Input:", x
    if len(x) == 0:
        return x    
    else:
        head, tail = x[0],x[1:]
        return [head]+ rd([c for c in tail if c != head])
    
print "result : ", rd(list("dgheihhdi"))

#and its output

Input: ['d', 'g', 'h', 'e', 'i', 'h', 'h', 'd', 'i']
Input: ['g', 'h', 'e', 'i', 'h', 'h', 'i']
Input: ['h', 'e', 'i', 'h', 'h', 'i']
Input: ['e', 'i', 'i']
Input: ['i', 'i']
Input: []
result : ['d', 'g', 'h', 'e', 'i']

FWIW I have about 5 hours experience programming Haskell so I am definitely not the person to ask for advice about Haskell

Also it sounds like you're maybe just getting into proramming? Haskell is a very tough introduction to programming imo.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 02:46 AM
Anyone play with any of the open source PaaS offerings? CloudFoundry is pretty sweet.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 04:59 AM
Quote:
Originally Posted by Ryanb9
Is anyone good at making games who would want to give me a little help on some issues? The main thing I am concerned about is organization / layout ... my project is getting very big and the layout I'm using (which is still the best I can find) is .... now in question. Anyone pm'able? >.<

edit: im basically looking for a non-language-specific layout / template for an event-driven program.
sng_jason used to work on that game that rhymes with "Wall of booty" as he called it. From reading his posts it seems hes primarily a game programmer, he may know the answers to your Qs
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 06:04 AM
I'd be interested in that answer as well, my game prototypes have bee utterly disorganized
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 10:23 AM
a basic game engine is typically going to look like this...

1. draw stuff

2. get player input

3. apply game "rules" (move game pieces, apply physics, etc...)

4. goto 1

This pretty much works whether you're making a chess game or a 60fps console shooter...

Try to keep things simple. Because a game "world" can be such an abstract concept, it can be easy to go overboard with object oriented design.... and before you know it, you're running the main game loop from "inside" a UI widget. Dont even begin to think that something like that is a good idea.

What kind of game are we talking about?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 10:33 AM
Quote:
Originally Posted by Freakin
Anyone play with any of the open source PaaS offerings? CloudFoundry is pretty sweet.
would this be like an alternative to heroku and similar offerings, or something you use in conjunction with them?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 10:43 AM
Quote:
Originally Posted by gaming_mouse
would this be like an alternative to heroku and similar offerings, or something you use in conjunction with them?
Alternative. With the open source options you can run a private cloud yourself. I'm actually looking at a fork of CloudFoundry called IronFoundry that supports .net and ms sql.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 11:13 AM
Hey, not a thread worthy question but I am trying to allow a user to browse directories to locate a file to be opened in a simple console c++ program. I can only use the std libraries and was hoping someone would be able to give me some keywords for a google search....

I am currently trawling through the wiki on the c++ standard library and confusing myself futher... any help would be appreciated...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 11:42 AM
Anyone know how well Chess games perform on mobile platforms? Is the processing power to low for them to be any good? Not a good enough chess player to judge for myself
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 11:48 AM
Is windows included in standard libraries? If so...

shbrowseforfolder might work from a console.
FindFirstFileEx otherwise
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 12:20 PM
Quote:
Originally Posted by myNameIsInga
Anyone know how well Chess games perform on mobile platforms? Is the processing power to low for them to be any good? Not a good enough chess player to judge for myself
Pretty sure the average mobile platform has many times the processing power of most electronic chess sets, so I would imaging that processing power is not really an issue.

I am not a chess expert so could be wrong
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 01:28 PM
Quote:
Originally Posted by Neko
.
explanation is very good thankyou! although im stuck on a new problem which im going to stare at for a few more hours before i post! getting my head round is very difficult! lol

you seem pretty decent for 5 hours experience, (and yeh ive only learned basics of C before)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 01:33 PM
Quote:
Originally Posted by MrWooster
Pretty sure the average mobile platform has many times the processing power of most electronic chess sets, so I would imaging that processing power is not really an issue.

I am not a chess expert so could be wrong
Thanks Bertie!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 01:34 PM
Quote:
Originally Posted by Chips Ahoy
Is windows included in standard libraries? If so...

shbrowseforfolder might work from a console.
FindFirstFileEx otherwise
unfortunately not. any other ideas?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 01:39 PM
Quote:
Originally Posted by dontbeleivethehype
unfortunately not. any other ideas?
http://en.wikipedia.org/wiki/Dirent.h
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 01:48 PM
Quote:
Originally Posted by NoahSD
If you like stuxnet, you'll love conficker: http://www.theatlantic.com/magazine/...y-within/8098/ . It's not as sophisticated, but it's got way more mystery surrounding it.

Spoiler alert: Stuxnet was the Israelis or the Americans, obv. Conficker is someone who's incredibly knowledgeable and even more crafty, but apparently all he wants to do is spam people or something?
I wonder what odds people would lay that one of the guys from the cabal is the actual author. Ukrainian keyboard thing is not in sync with the worm overall so it looks like a red herring
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 01:58 PM
Quote:
Originally Posted by clowntable
I wonder what odds people would lay that one of the guys from the cabal is the actual author. Ukrainian keyboard thing is not in sync with the worm overall so it looks like a red herring
Yeah. That's gotta be playing in people's minds after some of the really remarkable and quick responses.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 02:05 PM
Quote:
Originally Posted by NoahSD
Yeah. That's gotta be playing in people's minds after some of the really remarkable and quick responses.
Thought struck me too..

One thing I didn't get a clear idea of was how many people are in the cabal. Any idea? Chance of one of them being involved should be higher if its a big group of people thats not tightly held together.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 02:46 PM
Question:
"If you were tasked to create a dynamic website (with backend access to a database) that needed to be highly elastic in scalability (potential spikes of 100K+ simultaneous users), what platform (hosting,language,service) would you recommend to use to construct the site?"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 02:54 PM
Quote:
Originally Posted by sng_jason
a basic game engine is typically going to look like this...

1. draw stuff

2. get player input

3. apply game "rules" (move game pieces, apply physics, etc...)

4. goto 1

This pretty much works whether you're making a chess game or a 60fps console shooter...

Try to keep things simple. Because a game "world" can be such an abstract concept, it can be easy to go overboard with object oriented design.... and before you know it, you're running the main game loop from "inside" a UI widget. Dont even begin to think that something like that is a good idea.

What kind of game are we talking about?
Yeah I have a class that polls events and adds them to a que and my main loop is inside that class >.<. And the game im trying to copy is Minish Cap.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 03:01 PM
Quote:
Originally Posted by myNameIsInga
Thought struck me too..

One thing I didn't get a clear idea of was how many people are in the cabal. Any idea? Chance of one of them being involved should be higher if its a big group of people thats not tightly held together.
There's a bit of info here: http://www.confickerworkinggroup.org/wiki/ . It's confusing, though, because I'm not sure if that is a (very short) list of people in the group or a list of the contacts at the various companies that together make up the group. I didn't read much, though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m