Find Jobs
Hire Freelancers

Battleship Python Code Edited

$250-750 USD

Closed
Posted about 11 years ago

$250-750 USD

Paid on delivery
Need to complete the following python shell code: import pygame import random # RESOURCES def drawBoards(screen, board1, board2): [login to view URL](screen, 40, 80, 25) [login to view URL](screen, 350, 80, 25) [login to view URL]() def convertToBoard(pos): x = int((pos[0] - 350) / 25) y = int((pos[1] - 80) / 25) return (x, y) class Board: def __init__(self): [login to view URL] = [[0 * 10] * 10 for x in range(10)]; def drawSelf(self, screen, x, y, tileSize): for r in range(len([login to view URL])): for c in range(len([login to view URL][r])): if [login to view URL][r][c] == 0: # blank water = blue drawColor = (0, 0, 255) elif [login to view URL][r][c] == 1: # unhit ship = light blue drawColor = (150, 150, 255) elif [login to view URL][r][c] == 2: # miss = yellow drawColor = (255, 255, 0) elif [login to view URL][r][c] == 3: # hit ship = red drawColor = (255, 0, 0) [login to view URL](screen, drawColor, [login to view URL](x + c * tileSize, y + r * tileSize, tileSize, tileSize)) for r in range(len([login to view URL])): [login to view URL](screen, (0, 0, 0), (x + r * tileSize, y), (x + r * tileSize, y + len([login to view URL]) * tileSize)) [login to view URL](screen, (0, 0, 0), (x, y + r * tileSize), (x + len([login to view URL]) * tileSize, y + r * tileSize)) def setValue(self, x, y, value): [login to view URL][y][x] = value def getValue(self, x, y): return [login to view URL][y][x] def enemyAttack(player): # DO STUFF HERE # /DO STUFF HERE return False def playerAttack(enemy, seenEnemy, x, y): # DO STUFF HERE # /DO STUFF HERE return False def placeShip(board, shipSize): # DO STUFF HERE # /DO STUFF HERE pass # /RESOURCES screen = pygame.display.set_mode((640, 480)) playersTurn = True # TODO: set up player, enemy, and seenEnemy boards # DO STUFF HERE # place ships # /DO STUFF HERE while True: evt = [login to view URL]() if [login to view URL] == [login to view URL]: break if playersTurn and [login to view URL] == [login to view URL]: # process mouse actions coord = convertToBoard([login to view URL]) x = coord[0] y = coord[1] # TODO: process human input, fire at point (x, y) # DO STUFF HERE # /DO STUFF HERE # process enemy attack if not playersTurn: if enemyAttack(player): enemyHits += 1 playersTurn = True # TODO: call drawBoards with appropriate input # DO STUFF HERE # /DO STUFF HERE # after victory, wait for X button while True and (playerHits == 17 or enemyHits == 17): evt = [login to view URL]() if [login to view URL] == [login to view URL]: break [login to view URL]()
Project ID: 4467000

About the project

8 proposals
Remote project
Active 11 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
8 freelancers are bidding on average $348 USD for this job
User Avatar
Could you please send the code as Python file?
$385 USD in 6 days
4.9 (22 reviews)
4.6
4.6
User Avatar
Hi. Please check my pm.
$367 USD in 6 days
5.0 (2 reviews)
3.0
3.0
User Avatar
Greetings, I am developer with 3+ years of experience with python, looking forward to work with you on implementation of battleship game.
$275 USD in 5 days
5.0 (1 review)
2.1
2.1
User Avatar
hello, i am a professional developer, i have checked ur requirements and consider it done with quality, my freelancer username is my skype and gmail, waiting to discuss with u
$262 USD in 4 days
5.0 (2 reviews)
0.6
0.6
User Avatar
I am a skilled python programmer and I have made games with pygame before. Your project is a piece of cake for me. Money back guarantee if not satisfied, for whatever reason.
$275 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Dear Sir, Having read your project, and the accompanying PDF I believe this project could be completed in approximately 2-3 days. I am offering fully commented code and inclusion of the 'extra-credit' assignment (i.e. 'intelligent' rather than random computer actions). I have used Python and PyGame for similar projects in the past. Regards.
$275 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
I can do it
$385 USD in 5 days
0.0 (0 reviews)
0.0
0.0
User Avatar
I hope I could help you to solve this problem. The work I use python development, so the problem is that I can quickly help you solve.
$550 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Please check your PM
$275 USD in 2 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
0.0
0
Payment method verified
Member since Apr 26, 2013

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.