Hi i need someone to help me at least to give me an idea of how start thos assigment, is my first time taking a python class and is so advance for 1 month. I have to create a board game connect 4 with this instructions:

The rules are as follows: two players take turns dropping checkers (red and black) into any column of a rack with 7 columns and 6 rows. Each checker falls to the lowest empty slot in the column into which it is dropped. The game is won when a player gets 4 checkers of their color in a row, whether horizontal, vertical or diagonal.

You will need to define classes to model the various objects in this game. Each class will allow objects to have data about their state, and methods for what they do (or what can be done to them). Exactly what the objects will be in your program is up to you, but at a minimum you should make the rack an instance of a class. Other possibilities include players, columns, checkers, rounds, etc.

The user interface for your program is also up to you, but a simple way is to have a text-based interface where you print out a representation of the board state each move. An example is below:

1 2 3 4 5 6 7
- - - - - - -
- - - - - - -
- - - - - - -
- - - R - - -
- R - B - - -
- B R B - B -
1 2 3 4 5 6 7

Enter Red Player move:
Here is some code that may help you get started:

class Rack(object):

def __init__(self):
"""
This is the constructor for your Rack class.
It is a good place to initialize instance variables
(the information that the rack will "know" about itself).
"""
pass #your code goes here

def __str__(self):
"""
This method tells Python how to convert the object to a string.
It should give some indication of the state of the rack
and might be a method to use to "print out" the board during
a game.
"""
pass #your code goes here
Can someone please help me out!!!!.... At least ideas of how the structure have to go.

Recommended Answers

All 2 Replies

Think progress of one game, what user sees, what he inputs, what computer shows/asks, how the game finishes.
Find different objects and actions from the story and start coding. Post the results when you have created main logic and/or first part of the solution.
By the way to get fixed width letters and indention working remember to use code tags ((code) button)
The board for example looks more correct, even it is not code:

1 2 3 4 5 6 7
- - - - - - -
- - - - - - -
- - - - - - -
- - - R - - -
- R - B - - -
- B R B - B -
1 2 3 4 5 6 7

This assignment does not require you to make logic of play for computer and computer to participate in play in any way, only to act as not material game board., isn't it so?

STOP CHEATING!!! I'm telling Mr. Grossberg!!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.