Archive

Posts Tagged ‘programming’

Prolog — Install and use

this is a quick guide on how to get going with swi-prolog. Prolog is a fith generathion “declerative” laungage, it uses facts and rules which can then be quired to give a responce, this sort of thing can used to create Artifical Inteligence (AI). Despite this sounding complicated it is in fact much easier to use and learn (once youve got your head round the way it works) than other (4th generation) laungages such as java and c++.

First of all you need to download it, go to http://www.swi-prolog.org/dl-stable.html and download the version of prolog for you operating system. You can then run the file you have downloaded (follow the instructions) to install it.

Prolog programs are saved as text files, ending in .pl, you should save these into the prolog folder (this was created in my documents during installation) these can then be opened by typing [file without .pl]. rember the dot (.) at the end, in the prolog window.

To run a prolog program you must first open the prolog command thing, from the start menu, programs can then be loaded and run.

Some things to rember about prolog:
>all commands and lines should end in a dot
>leave a line at the end of each file
>reload a file after it has been changed
>dont use capital letters for values only for things in which the value changes
>it wont recognise a calculation unles you use is, X=5+2 doesnt mean X=7 but X is 5+2 does
>a semi collon (;) will show the next result of the query

I dont have a good enough knowlage to write a full tutorial of prolog, only some basic points like those above however a good one is at

http://www.cs.nuim.ie/~jpower/Courses/PROLOG/

anyway enjoy coding

Advertisements

Happy New Year

Happy new year!!!!!!!!!.

Trevor Update

IN trevor I have developed a system for reading in Levels from files. Ive done this by allowing the level to be stored as a string array where by each character i the string represents an obj in a row of the game eg)
gggggggggtttssggggss
would create a row with a stretch of ground, followed by three triangles two spikes another stretch of ground and 2 more spikes. I then read in the file a line at a time and create each successive row. Empty spaces can be made by putting a character that hasn’t been assigned a specif object type eg) 0 or “space”. These just initalise an object with the type property set to “empty”.

Ive also started creating moving platforms. Ive done this in a similar way to which i made moving emery’s but in still working on the way of making it so that Trevor moves with them. The main solution in looking at involves having a boolean value on the object called moving which is checked for in the gravity part of trevors movement loop and, if found to be true, adds this objects speed to trevors.


Juggling >> Diablo

For christmas i got a diablo which is another ting for me to add to my juggling tutorial. At the moment I am still learning the basics and some simple tricks(like a half sun). Hopefully soon i will have some videos of me doing these which i can put on Youtube and embed within my blogs. Another thing im aiming to do with this is to put a diablo learning section onto the end of each of my blogs which will explain each trick i learn when i learn it and any tips and tricks i come across.

Anti wobble

This is the posh name i just made up for stopping the diablo wobbling so that you can keep it going straight and makes it easier to throw and catch.

If the far end of the diablo is raising (so it tilts towards you) push forward with you string hands stick. If the near end is tilting towards you push forward your weak hands stick(or pull back you string hands). This should correct the diablo making it spin straight. An easy way to rember is the side thats lifting up is the side to push forward.