Commit Graph

30 Commits

Author SHA1 Message Date
Murilo Pereira
0a37b5982a Really, don't change the stack when calling stack#reverse. 2011-05-01 02:04:16 -03:00
Murilo Pereira
0e0c44f5c6 Non-destructive stack#reverse. 2011-05-01 01:13:15 -03:00
Murilo Pereira
5a62ecb955 Added stack#reverse. 2011-04-30 22:13:41 -03:00
Murilo Pereira
3420045a35 Refactored 'length(stack)' and added test. 2011-02-16 22:42:49 -02:00
Murilo Pereira
b1000cfb55 Moving game logic to the game object. 2011-02-16 22:27:00 -02:00
Murilo Pereira
417a8ca2b7 s/delete/free/g 2011-02-14 00:10:47 -02:00
Murilo Pereira
e59d089b45 Remove noob code. 2011-02-14 00:05:59 -02:00
Murilo Pereira
6c5970da62 Delete the whole linked list (omg noob?). 2011-02-14 00:04:26 -02:00
Murilo Pereira
777434177f Added tests for the stack and made them pass.
* Make 'empty(stack)' more robust
* Only try to 'push(stack, card)' if card != NULL
* Added message explaining why 'pop(stack)' needs to create a new
  stack object when popping a stack's last element
* 'move_card(stack, stack)' now checks if the origin pops something
   before trying to 'push(stack)' to destination. This prevents
   dereferencing a possible NULL pointer.
2011-02-13 23:13:16 -02:00
Murilo Pereira
60641ca499 Avoid dereferencing NULL pointers. 2011-02-12 01:26:03 -02:00
Murilo Pereira
e8cf7b92a0 This is better here. 2011-02-09 23:51:07 -02:00
Murilo Pereira
0019ad647b Not using this function. 2011-02-06 21:27:39 -02:00
Murilo Pereira
8d1b2ca7b4 Declaring local functions as static. 2011-02-06 04:51:49 -02:00
Murilo Pereira
5adba921f9 Moving stack-related constants to the stack header file. 2011-02-06 04:03:40 -02:00
Murilo Pereira
75d1e5f23b Pessimistic memory allocation.
* Added/removed headers as necessary
* Removed 'key_event' function from keyboard
2011-02-06 03:45:58 -02:00
Murilo Soares Pereira
7b39ec5cc6 Erasing stacks when empty. Also moved some event-related code to the keyboard object. 2010-04-21 04:14:39 -03:00
Murilo Soares Pereira
45b7939665 Moves to maneuvre stack must consider when it isn't empty, also. 2010-04-11 18:22:13 -03:00
Murilo Soares Pereira
0c798f3d56 When a card is moved between stacks, its coordinates are refreshed. 2010-04-11 17:15:33 -03:00
Murilo Soares Pereira
7c30e006b6 Fixed the function that checks if a given stack is empty. 2010-04-09 01:23:10 -03:00
Murilo Soares Pereira
18cf795914 Added function to move cards between stacks. 2010-04-09 00:49:17 -03:00
Murilo Soares Pereira
c744581711 The stack initializer now initializes its card also. 2010-04-09 00:37:57 -03:00
Murilo Soares Pereira
90c7ce6280 delete() for all structures. 2010-04-08 01:11:10 -03:00
Murilo Soares Pereira
ecaa2a4c68 Created the 'deck' structure, allocate() and initialize() for all structures. 2010-04-08 01:11:10 -03:00
Murilo Soares Pereira
3889a40850 Fixing header's dependencies. 2010-04-04 21:54:22 -03:00
Murilo Soares Pereira
8173aaa7ff Fixed empty() to use the new initialize_stack(), and pop(). 2010-04-04 21:20:38 -03:00
Murilo Soares Pereira
e72d21f1f0 Fixed malloc() and pop(). 2010-04-04 21:20:38 -03:00
Murilo Soares Pereira
ad737aa765 Fixed push(). 2010-04-04 21:20:38 -03:00
Murilo Soares Pereira
84383a3275 Fixed length(). 2010-04-04 21:20:38 -03:00
Murilo Soares Pereira
f0aa621e69 Added pop() and function prototypes. 2010-04-04 21:20:37 -03:00
Murilo Soares Pereira
4bb10a54cc Added stack files, with push(). 2010-04-04 21:20:36 -03:00