.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > YappA > Offtopic
Offtopic Just anything. You have time to waste ? Prove it !!!

Reply
 
Thread Tools
Re: Show off your finest piece of code!
Old
  (#11)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Show off your finest piece of code! - 30-12-2004

Quote:
Originally Posted by Rifleman
I would love to
You should grab Allegro, you can get a windows binary , lib package or 'compilable version' (source) from http://www.allegro.cc , i suggest you grab the compilable version and make it compile, (read the documents very well). Its a bit of fiddling around with the paths (well, COULD be), but once THAT compiles, the game will compile.

Its 10MB (zipped), but it contains all you need: Source, gfx, grabber utility, etc.

CS2d\CS2d contains the source
CS2d\<dir> contains what it should contain (look at the name)

ow, and if you look at the source, you will laugh your ass off, seriously.

http://realbot.bots-united.com/files/CS2D.ZIP

(its up)


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me

Last edited by stefanhendriks; 30-12-2004 at 17:59..
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#12)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Show off your finest piece of code! - 30-12-2004

hey , dude that link's broken ...

AH and yes , would you mind if I use the code ? OF course credit will be given

Last edited by Rifleman; 30-12-2004 at 17:48..
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#13)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Show off your finest piece of code! - 30-12-2004

fixed the link.

sure, no problem (else i would'nt have put it here anyways).


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#14)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Show off your finest piece of code! - 30-12-2004

here`s my 2cents a nice little cpp doubly linked list class

Code:
 CLinkedList *pLL = NULL;
 
 static bool	bStart = TRUE;
 
 CLinkedList::~CLinkedList( )
 {
 	delete (pLL);
 	pLL = NULL;
 	bStart = TRUE;
 }
 
 void CLinkedList::SetToStartNode ( )
 {
 	while (pLL->prev != NULL)
 		pLL = pLL->prev;
 }
 
 void CLinkedList::SetToEndNode ( )
 {
 	while (pLL->next != NULL)
 		pLL = pLL->next;
 }
 
 long CLinkedList::GetNumberOfNodes ( )
 {
 	long lNumberOfNodes;
 
 	pLL->SetToStartNode ();
 
 	lNumberOfNodes = 0;
 
 	while (pLL->next != NULL)
 	{
 		pLL = pLL->next;
 		lNumberOfNodes++;
 	}
 
 	return (lNumberOfNodes);
 }
 
 void CLinkedList::DeleteAllNodes ( )
 {
 	pLL->SetToEndNode ();
 
 	while (pLL->prev != NULL)
 	{
 		pLL = pLL->prev;
 		delete (pLL->next);
 		pLL->next = NULL;
 	}
 
 	bStart = TRUE;
 	return;
 }
 
 void CLinkedList::AddNode (int iData)
 {
 	CLinkedList *pNewNode;
 
 	if (bStart)
 	{
 		bStart = FALSE;
 		pLL->iData = iData;
 		pLL->prev = NULL;
 		pLL->next = NULL;
 	}
 	else
 	{
 		pLL->SetToEndNode ();
 		pNewNode = new (CLinkedList);
 		pLL->next = pNewNode;
 		pNewNode->prev = pLL;
 		pNewNode->iData = pLL->iData;
 		pNewNode->next = NULL;
 		pLL = pNewNode;
 	}
 }
 
 void CLinkedList::DeleteNode ( )
 {
 	CLinkedList *pNode = NULL;
 
 	if (pLL->next != NULL)
 		pNode = pLL->next;
 	else if (pLL->prev != NULL)
 		pNode = pLL->prev;
 	else // dont delete the start node
 		return;
 
 	pLL->prev->next = pLL->next;
 	pLL->next->prev = pLL->prev;
 
 	pLL = pNode;
 	return;
 }
 
 void CLinkedList::GoToNextNode ( )
 {
 	if (pLL->next != NULL)
 		pLL = pLL->next;
 }
 
 void CLinkedList::GoToPreviousNode ( )
 {
 	if (pLL->prev != NULL)
 		pLL = pLL->prev;
 }
 
 bool CLinkedList::IsNextNodeNull ( )
 {
 	if (pLL->next != NULL)
 		return FALSE;
 	return TRUE;
 }
 
 bool CLinkedList::IsPrevNodeNull ( )
 {
 	if (pLL->prev != NULL)
 		return FALSE;
 	return TRUE;
 }
 
 int CLinkedList::GetVar ( )
 {
 	return (pLL->iData);
 }
 
 
 class CLinkedList
 {
 	int			iData;
 	CLinkedList *prev;
 	CLinkedList *next;
 
 public:
 	// Class Construction
 	CLinkedList ( ) :  prev(NULL), next(NULL) , iData(0)
 	{
 	}
 	// Class Destruction
 	virtual		~CLinkedList ( );
 	// Class Function Prototypes...
 	void		AddNode (int fData);
 	void		DeleteNode ( );
 	void		DeleteAllNodes ( );
 	void		SetToStartNode ( );
 	void		SetToEndNode ( );
 	long		GetNumberOfNodes ( );
 	void		GoToNextNode ( );
 	void		GoToPreviousNode ( );
 	bool		IsNextNodeNull ( );
 	bool		IsPrevNodeNull ( );
 	int			GetVar ( );
 };
 extern CLinkedList *pLL;
enjoy Dubb.
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#15)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Show off your finest piece of code! - 30-12-2004

hm, somehow you missed something in your c++ course

remove that pLL variable ... in the methods of that class ( that are the fucntions of a class ) you can access its variables directly. your solution works fine for one instance of that class, but you'll get into trouble once you wanna have more of them

PS: deleting isnt permitted in this forums just edit it if you like to



Last edited by @$3.1415rin; 30-12-2004 at 21:21..
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#16)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Show off your finest piece of code! - 30-12-2004

thanks for that aspirin, i will upload a fixed version at about 10pm GMT
going out now.
p.s what names do you guys play cs under mines -=[AK]=- Dubb because i might have been playing with you yesterday.
p.p.s could one of the moderators delete the previous code thread.
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#17)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: Show off your finest piece of code! - 31-12-2004

I would say my vector class is good, but I am not sure whether it works properly with pointers, so I'll only post part of it.

Code:
class vector3
 {
 	public:
 		vector3(void);
 		vector3(float tempx, float tempy, float tempz);
 		vector3(const vector3 &vector);
 
 		float getLength(void);
 
 		void normalize(void);
 		vector3 normalized(void);
 
 		vector3 operator+(vector3 vector);
 		vector3 operator-(vector3 vector);
 		vector3 operator*(vector3 vector);
 		bool operator==(vector3 vector);
 		bool operator!=(vector3 vector);
 		void operator=(vector3 vector);
 
 		float dotProduct(vector3 vector);
 
 		float x, y, z;
 };
I mean, it works properly, but I think that some overloaded operators will shit themselves if you try to use a pointer. I have it under the X Consortium License.


sfx1999.postcount++
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#18)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Show off your finest piece of code! - 31-12-2004

ah and yes stefan , do I need to do extra stuff with Allegro or just install it ?
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#19)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Show off your finest piece of code! - 31-12-2004

Allegro is a library, you can just compile it and copy it into your MSVC folder
  
Reply With Quote
Re: Show off your finest piece of code!
Old
  (#20)
Rifleman
This user broke our rules and has been BANNED
 
Status: Offline
Posts: 128
Join Date: Sep 2004
Location: Mars
Default Re: Show off your finest piece of code! - 31-12-2004

I get the Windows Binary version and I do the manual installation then I think its alright since I have copied many lib files into the "LIB" directory
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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 On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com