Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97939 > unrolled thread

Python v3.4.3

Started byChubasco Diranga <alpharulz@gmail.com>
First post2015-10-25 01:38 -0700
Last post2015-10-25 04:41 -0700
Articles 4 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Python v3.4.3 Chubasco Diranga <alpharulz@gmail.com> - 2015-10-25 01:38 -0700
    Re: Python v3.4.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-10-25 22:35 +1100
    Re: Python v3.4.3 Chubasco Diranga <alpharulz@gmail.com> - 2015-10-25 04:37 -0700
    Re: Python v3.4.3 Chubasco Diranga <alpharulz@gmail.com> - 2015-10-25 04:41 -0700

#97939 — Python v3.4.3

FromChubasco Diranga <alpharulz@gmail.com>
Date2015-10-25 01:38 -0700
SubjectPython v3.4.3
Message-ID<7f33ce74-95cc-4f52-802c-28a7ea82ba2b@googlegroups.com>
How do l create a simple display your current location on a python code?

Example:
Display your current location on the map with two asterisk (**). How do i modify the DisplayMap function a a python code game?

[toc] | [next] | [standalone]


#97942

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-10-25 22:35 +1100
Message-ID<562cbe6c$0$1598$c3e8da3$5496439d@news.astraweb.com>
In reply to#97939
On Sunday 25 October 2015 19:38, Chubasco Diranga wrote:

> How do l create a simple display your current location on a python code?
> 
> Example:
> Display your current location on the map with two asterisk (**). How do i
> modify the DisplayMap function a a python code game?


The usual way to modify a function is to edit the source code with a text 
editor. Do you have the source code? What does the DisplayMap function do?

Since you have not given us much information to go by, I can only guess that 
you would edit the DisplayMap function like this:

def DisplayMap():

    ...  # existing code remains the same

    # add these lines to the *end* of the function
    # just before the "return..." statement.
    point = GetCurrentLocation()
    Draw("**", point)


but without seeing the actual code, this is just a guess and is probably 
nonsense.



-- 
Steve

[toc] | [prev] | [next] | [standalone]


#97943

FromChubasco Diranga <alpharulz@gmail.com>
Date2015-10-25 04:37 -0700
Message-ID<0fbd57b6-f197-4070-b1b3-a1f95684fe84@googlegroups.com>
In reply to#97939
On Sunday, October 25, 2015 at 9:38:38 PM UTC+13, Chubasco Diranga wrote:
> How do l create a simple display your current location on a python code?
> 
> Example:
> Display your current location on the map with two asterisk (**). How do i modify the DisplayMap function a a python code game?

Thanks steve it did work :D Much appreciated, code is included as follows,

def Game():
    # Win condition: pick up more than 5 items and go back to location 0
    while not (GetScore() >= 5 and currentLocation == 0):
    

        print("========Haunted House=========")
        print("YOU ARE LOCATED IN A ", LocationsList[currentLocation],"("+str(currentLocation)+")")
        if ItemsAvailableAtPosition():
            print("YOU CAN SEE THE FOLLOWING ITEMS AT THIS LOCATION: ", ListItemsAtPosition())
        print("VISIBLE EXITS: ", DirectionsList[currentLocation])
        DisplayMap()
        
        statement = input("WHAT DO YOU WANT TO DO NEXT?")
        statement = statement.upper()
        ProcessStatement(statement)
        if not (currentLocation in VisitedLocations):
            VisitedLocations.append(currentLocation)
        
    DisplayCongratulation()

# Program starts here!
Game()

[toc] | [prev] | [next] | [standalone]


#97944

FromChubasco Diranga <alpharulz@gmail.com>
Date2015-10-25 04:41 -0700
Message-ID<47e5d3ba-e1f6-4aa0-b37d-311822e479dd@googlegroups.com>
In reply to#97939
On Sunday, October 25, 2015 at 9:38:38 PM UTC+13, Chubasco Diranga wrote:
> How do l create a simple display your current location on a python code?
> 
> Example:
> Display your current location on the map with two asterisk (**). How do i modify the DisplayMap function a a python code game?

Sorry Steven miss spelled your name again Thank you 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web